My command:
c:\temp\abc.exe c:\temp\abc.ini >> c:\temp\log.log
This works fine when executed by the command prompt.
But from VB.NET, it doesn't work (the log file was created but blank, the log file should contain log processes of abc.exe, abc.exe was not executed also).
Dim p as Process = new Process()
Dim pi as ProcessStartInfo = new ProcessStartInfo()
pi.Arguments = "/C c:\temp\abc.exe c:\temp\abc.ini >> c:\temp\log.log "
pi.FileName = "cmd.exe"
p.StartInfo = pi
p.Start()
p.WaitForExit()
Why?
Update: While waiting for an explanation, this is my workaround.
Dim p as Process = new Process()
Dim pi as ProcessStartInfo = new ProcessStartInfo()
pi.Arguments = "c:\temp\abc.ini"
pi.FileName = "c:\temp\abc.exe"
p.StartInfo = pi
p.Start()
Dim output as String = p.StandardOutput.ReadToEnd()
p.WaitForExit()
WriteLog("c:\temp\log.log", output)