Skip to content

Instantly share code, notes, and snippets.

@rgunst
Created February 26, 2015 20:24
Show Gist options
  • Save rgunst/e682be4774c15ed1d97c to your computer and use it in GitHub Desktop.
Save rgunst/e682be4774c15ed1d97c to your computer and use it in GitHub Desktop.
sudo for powershell
function elevate-process
{
$file, [string]$arguments = $args;
$psi = new-object System.Diagnostics.ProcessStartInfo $file;
$psi.Arguments = $arguments;
$psi.Verb = "runas";
$psi.WorkingDirectory = get-location;
[System.Diagnostics.Process]::Start($psi);
}
set-alias sudo elevate-process;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment