C# ProcessWindowStyle.Minimized does not work for PSR.exe

Viewed 2119

Gurus,

I am struggling with a basic function in C#. I am not a develop expert, but I want to develop a PoC for a given customer requirement. Your guidance is welcome.

I am using the following peace of code, however, it is not working as expected.

I want to open psr.exe minimized, but looks like the windows style has been ignored.

ProcessStartInfo proc = new ProcessStartInfo("psr.exe");
proc.Arguments = "/start /output ....;
proc.WindowStyle = ProcessWindowStyle.Minimized;
proc.RedirectStandardOutput = true;
proc.UseShellExecute = false;
proc.CreateNoWindow = true;
Process.Start(proc);

Thanks in advance.

1 Answers

Use shellExecute true and run the application with admin privilges,

string fileName = @"C:\Program Files (x86)\RequiredApp.exe";
Process process = new Process();
process.StartInfo.Arguments = null;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.StartInfo.FileName = fileName;
process.StartInfo.UseShellExecute = true;
process.Start();
Related