Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void elevateCurrentProcess()
- {
- ProcessStartInfo startInfo = new ProcessStartInfo();
- startInfo.UseShellExecute = true;
- startInfo.WorkingDirectory = Environment.CurrentDirectory;
- startInfo.FileName = Application.ExecutablePath;
- startInfo.Verb = "runas";
- try
- {
- Process p = Process.Start(startInfo);
- }
- catch
- {
- // User didn't allow UAC
- return;
- }
- Application.Exit();
- }
Add Comment
Please, Sign In to add comment