4

Possible Duplicate:
C#: Run external console program as hidden

I am using a Windows Forms application that needs to start a console app. I don't want the console app be displayed on windows task

I setting p.WindowStyle = ProcessWindowStyle.Hidden;

But it doesn't work, the process is showing

Code:

ProcessStartInfo p = new ProcessStartInfo();

p.UseShellExecute = false;
p.RedirectStandardOutput = true;
p.FileName = "rasdial";
p.Arguments = string.Format("\x22{0}\x22", name);
p.WindowStyle = ProcessWindowStyle.Hidden;

Process process = Process.Start(p);

Any help would be appreciated. Thanks in advance!

Community
  • 1
  • 1
The Mask
  • 17,007
  • 37
  • 111
  • 185
  • What do you mean by saying "I don't want the console app be displayed on windows task" ? The console window is not visible to the user? – Tigran Jul 10 '11 at 15:18
  • 1
    I upvoted. I don't know what's going on StackOverflow, but the place is feeling increasingly hostile to questions (the reason everyone is here, in the first place). – Alexandre Bell Jul 10 '11 at 15:31
  • Sorry for inconvenience. try any help here is it an error? – The Mask Jul 10 '11 at 15:39
  • +1 to get 0. I think it is a good question, but it is a duplicate, so I have to flag it too. – MajesticRa Jul 10 '11 at 15:52

1 Answers1

8

The solution:

p.CreateNoWindow = true;
The Mask
  • 17,007
  • 37
  • 111
  • 185