I'm working on a program that relies on another program to convert some data. This other program is a command line executable. The code I'm using is as follows.
That should work, but the input to the command line never gets processed because as soon as the process is started, it ends. Setting to CreateNoWindow to false shows the command prompt opening for a split second and then closing, even though the operation should take at least several seconds. Scouring the internet reveals no clue as to why this is happening. If I set UseShellExecute to true, the window stays open, but I can't redirect input that way. This is really frustrating.
Can anyone offer some insight as to why this is happening?
VB.NET:
Using m_process As New Process()
With m_process.StartInfo
.FileName = "cmd.exe"
.UseShellExecute = False
.RedirectStandardInput = True
.CreateNoWindow = True
End With
m_process.Start()
For Each file As FileInfo in folder
m_process.StandardInput.WriteLine("somecommand")
Next
m_process.Close()
End Using
That should work, but the input to the command line never gets processed because as soon as the process is started, it ends. Setting to CreateNoWindow to false shows the command prompt opening for a split second and then closing, even though the operation should take at least several seconds. Scouring the internet reveals no clue as to why this is happening. If I set UseShellExecute to true, the window stays open, but I can't redirect input that way. This is really frustrating.
Can anyone offer some insight as to why this is happening?
Last edited: