stop command prompt from showing up for new process

Z

Zamil

Hello all,

I am trying to read in all the output from netstat.exe into my
program. While I have been successfull in doing so, I have some issues
that I cannot solve. I don't want the black window to show up, I want
it run in the background. The black window doesn't show anything in it
as I've already redirected the output to a stream. In any case, here
is my code:

Process process = new Process();
process.StartInfo.FileName = "netstat.exe";
process.StartInfo.Arguments = "-a -p TCP -b";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;

// start the process
process.Start();



I have fooled around with the StartInfo.WindowStyle and set it to
hidden, but it doesn't seem to do anything. I have also tried
Minimized and Maximized and they don't do anything either. Has anybody
figured out a way of doing this? Maybe Process isn't the right class
to use?

Any suggestions would be welcomed.

Thanks
 
X

X-Killer

Hi Zamil,

Scroll up a little bit in the Intellisense and you'll find the
StartInfo.CreateNoWindow property.

Cheers.
 
Z

Zamil

I tried this as well and it also doesn't seem to do anything. If I
change my app to launch say notepad.exe all of these commands work
properly. I can CreateNoWindow and change the WindowStyle.

Any other suggestions?

Thanks
Zamil
 
X

X-Killer

Just to inform you that I had created the exact winform program and it
simply runs as expected without showing any dos windows.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top