G
Guest
I'm coding an ASP.NET application using C# in Visual Studio.NET. I've researched the Process class and its associated members extensively, and I'm fairly certain my code is solid.
I'm attempting to use a streamreader to read the output from an external command line application (grep.exe, in this case, though I've tried it with ipconfig.exe, and I get the same results) using the following code
Process grep = new Process();
grep.StartInfo.FileName = "grep.exe"
grep.StartInfo.Arguments = "-inr \"Foobaroo\" --include=*.foo *.*"
grep.StartInfo.UseShellExecute = true
grep.StartInfo.RedirectStandardOutput = true
grep.Start();
StreamReader sr = grep.StandardOutput
string output = sr.ReadLine()
grep.WaitForExit();
Response.Write("Filename: " + grep.StartInfo.FileName + "<br>")
Response.Write("Arguments: " + grep.StartInfo.Arguments + "<br>")
Response.Write("Output: " + output)
While the debugging window indicates that I get an exitcode of 0x0, there is no console window that pops up, yet the Output string remains blank. I tried to watch for a new process in the Task Manager, but nothing shows up (not really definitive, but interesting).
Again, the same thing happens with ipconfig.exe, which I know should produce output (as with this grep app).
Any thoughts on what may cause these applications, which show textual output when executed from the command line, to fail to generate any output for my application? (A note: My regular expressions are not the issue, of this I am certain
Thanks, I really appreciate the help
-- Michael Conove
Cerner Healthcare Information System
I'm attempting to use a streamreader to read the output from an external command line application (grep.exe, in this case, though I've tried it with ipconfig.exe, and I get the same results) using the following code
Process grep = new Process();
grep.StartInfo.FileName = "grep.exe"
grep.StartInfo.Arguments = "-inr \"Foobaroo\" --include=*.foo *.*"
grep.StartInfo.UseShellExecute = true
grep.StartInfo.RedirectStandardOutput = true
grep.Start();
StreamReader sr = grep.StandardOutput
string output = sr.ReadLine()
grep.WaitForExit();
Response.Write("Filename: " + grep.StartInfo.FileName + "<br>")
Response.Write("Arguments: " + grep.StartInfo.Arguments + "<br>")
Response.Write("Output: " + output)
While the debugging window indicates that I get an exitcode of 0x0, there is no console window that pops up, yet the Output string remains blank. I tried to watch for a new process in the Task Manager, but nothing shows up (not really definitive, but interesting).
Again, the same thing happens with ipconfig.exe, which I know should produce output (as with this grep app).
Any thoughts on what may cause these applications, which show textual output when executed from the command line, to fail to generate any output for my application? (A note: My regular expressions are not the issue, of this I am certain
Thanks, I really appreciate the help
-- Michael Conove
Cerner Healthcare Information System