Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void ElevateNewProcess()
- {
- ProcessStartInfo startInfo = new ProcessStartInfo();
- startInfo.UseShellExecute = true;
- startInfo.WorkingDirectory = Environment.CurrentDirectory;
- startInfo.Verb = "runas"; // This will set it to run as an administrator.
- startInfo.Arguments = "/k echo This window is elevated && echo Tehee"; // The arguments to pass to the started application.
- startInfo.FileName = "cmd"; // Start a cmd application.
- Process.Start(startInfo);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement