Public Function ExecutaComandoMSDOS(ByVal pComando As String, ByVal
pParametros As String) As String
Dim _ret As String = ""Dim procShell As New Process()
'Seu comando vai aqui.
procShell.StartInfo.FileName = pComando
'Os argumentos, aqui.
procShell.StartInfo.Arguments = pParametros
procShell.StartInfo.CreateNoWindow = True
procShell.StartInfo.RedirectStandardOutput = True
procShell.StartInfo.UseShellExecute = False
procShell.StartInfo.RedirectStandardError = True
procShell.Start()
Dim streamReader As System.IO.StreamReader
streamReader = New System.IO.StreamReader(procShell.StandardOutput.BaseStream, procShell.StandardOutput.CurrentEncoding)
Do
Dim _line As String = streamReader.ReadLine()
If (IsNothing(_line)) Then Exit Do
_ret = _ret & _line & " "
Loop
streamReader.Close()
Return _ret
End Function
Nenhum comentário:
Postar um comentário