- Jan 21, 2005
- 17,722
- 6
- 81
So, I am using an open source program that accepts "batch" lists of files. But instead of a command line argument, it accepts them from STDIN. For example, you can run the program on the command line like this
And the codegen will give output with no issue.
However, I can't call this in VB.NET. Here is my current, non-working implementation...
What am I doing wrong? It opens up the command prompt and hangs. If you go to the command line and type "codegen.exe -s" only, you get this same behavior.
I have tried this:
and this...
and they don't work either... HELP!
Code:
codegen.exe -s < c:\path\to\file.txt
However, I can't call this in VB.NET. Here is my current, non-working implementation...
Code:
Dim CodegenProc As New Process
Dim CodegenStreamReader As StreamReader
CodegenStreamReader = My.Computer.FileSystem.OpenTextFileReader("c:\path\to\file.txt")
CodegenProc.StartInfo.RedirectStandardInput = True
CodegenProc.StartInfo.RedirectStandardOutput = True
CodegenProc.StartInfo.UseShellExecute = False
CodegenProc.StartInfo.FileName = "C:\codegen.exe"
CodegenProc.StartInfo.Arguments = "-s"
'CodegenProc.StartInfo.CreateNoWindow = True
CodegenProc.Start()
CodegenProc.StandardInput.WriteLine(CodegenStreamReader.ReadToEnd)
CodegenStreamReader.Close()
I have tried this:
Code:
CodegenProc.StartInfo.Arguments = "-s < c:\path\to\file.txt"
Code:
CodegenProc.StandardInput.Write("c:\path\to\file.txt")
Last edited: