Perchè non metti i comandi in un file BAT ed esegui quello?
Esempio, supponiamo che tu abbia un file comando.bat che fa la DIR del disco C e la scrive in un file txt:
codice:
@echo off
dir c:\*.* > d:\programmi\dirC.txt
Poi lo esegui così:
codice:
Using myProcess As New Process()
Try
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.FileName = "d:\programmi\comando.bat"
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
Catch ex As Exception
Console.WriteLine((ex.Message))
End Try
End Using