Skip to content

Instantly share code, notes, and snippets.

@agileguy
Created December 14, 2011 14:36
Show Gist options
  • Select an option

  • Save agileguy/1476823 to your computer and use it in GitHub Desktop.

Select an option

Save agileguy/1476823 to your computer and use it in GitHub Desktop.
SUDO for Powershell
$file, [string]$arguments = $args;
if([System.IO.File]::Exists("$(get-location)\$file"))
{
$file = "$(Get-Location)\$file";
}
$psi = new-object System.Diagnostics.ProcessStartInfo $file;
$psi.Arguments = $arguments;
$psi.Verb = "runas";
[System.Diagnostics.Process]::Start($psi);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment