Reputation: 71
I try to start a process(nginx) with this code:
Process.Start(@"C:\nginx\nginx-1.9.5\nginx.exe");
The problem is it just not starting it.
If I start nginx.exe manually then it working fine.
Any idea why it not working and how to fix it?
Upvotes: 0
Views: 1212
Reputation: 853
Try using administrator privileges:
ProcessStartInfo procInfo = new ProcessStartInfo(@"C:\nginx\nginx-1.9.5\nginx.exe");
procInfo.UseShellExecute = true;
procInfo.Verb = "runas";
Process.Start(procInfo);
Upvotes: 0
Reputation: 26
I encountered the same problem and finally solved it by changing the working directory to the folder that contains the nginx.exe
file.
Try adding the following line to your code:
procInfo.WorkingDirectory = @"C:\nginx\nginx-1.9.5";
Upvotes: 1