Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. private void ElevateNewProcess()
  2.         {
  3.             ProcessStartInfo startInfo = new ProcessStartInfo();
  4.             startInfo.UseShellExecute = true;
  5.             startInfo.WorkingDirectory = Environment.CurrentDirectory;
  6.             startInfo.Verb = "runas"; // This will set it to run as an administrator.
  7.             startInfo.Arguments = "/k echo This window is elevated && echo Tehee"; // The arguments to pass to the started application.
  8.             startInfo.FileName = "cmd"; // Start a cmd application.
  9.            
  10.             Process.Start(startInfo);
  11.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement