How to start a Process as administrator mode in C#
- by RP
I have a visual studio windows app project. I've added code to download an installer update file. The installer after it has finished downloading would need administrator privilages to run. I have added a manifest file.
When user clicks on the DownloadUpdate.exe, UAC prompts the user for Admin permissions. So i assumed that all processes created and called within DownloadUpdate.exe will run in admin capacity. So i made the setup call my downloaded file with the following code:
Process p = new Process();
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = strFile;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;