-1

Code:

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 4351");

I want start it hidden, how I can do it?

Alexander12
  • 1
  • 1
  • 1
  • ProcessStartInfo processStartInfo = new ProcessStartInfo(); processStartInfo.FileName = "...."; processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; Process process = Process.Start(processStartInfo); – George Findulov Sep 11 '15 at 08:23
  • possible duplicate of [Launching process in C# Without Distracting Console Window](http://stackoverflow.com/questions/739101/launching-process-in-c-sharp-without-distracting-console-window) – Hamid Pourjam Sep 11 '15 at 08:24
  • 1
    @dotctor It can't be a duplicate of that - this question does not launch a console window. – Matthew Watson Sep 11 '15 at 08:32

2 Answers2

3

You could set the WindowStyle property to Hidden like this:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "rundll32.exe";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
 //Start the process
 Process proc = Process.Start(startInfo);

Goodluck.

Slashy
  • 1,841
  • 3
  • 23
  • 42
0

one can do like the code below:

 ProcessStartInfo psi = new ProcessStartInfo();
 psi.FileName = ....
 psi.RedirectStandardInput = true;
 psi.RedirectStandardOutput = false;
 psi.Arguments =...
 psi.UseShellExecute = false;
 psi.CreateNoWindow = true; // <- key line
Miguel Tomás
  • 1,714
  • 1
  • 13
  • 23