1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Dim p As New Process
Dim arg As String
Dim retour As String = ""
Dim File As New IO.FileInfo("Nom du fichier avec chemin complet. Ex : C:\test.bat")
arg = "Mes arguments ici"
p.StartInfo.UseShellExecute = False
p.StartInfo.FileName = File.FullName
p.StartInfo.Arguments = arg
p.StartInfo.RedirectStandardOutput = True
'Facultatif, mais peut être nécessaire pour le bon fonctionnement du process
p.StartInfo.WorkingDirectory = File.DirectoryName
'Facultatif, permet de masquer le process
p.StartInfo.CreateNoWindow = True
p.Start()
While p.HasExited = False
retour = p.StandardOutput.ReadToEnd
End While
MessageBox.Show(retour) |
Partager