Skip to content

Instantly share code, notes, and snippets.

@retorillo
Created February 16, 2016 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save retorillo/edd3674ec6a6968debe2 to your computer and use it in GitHub Desktop.
Save retorillo/edd3674ec6a6968debe2 to your computer and use it in GitHub Desktop.
switch ($args.length) {
0 {
Write-Host "usage: sudo [<command> [arg1 arg2 ...]]"
}
1 {
start $args[0] -verb runas
}
default {
$alist = new-object string[] ($args.length - 1)
for ($c = 1; $c -lt $args.length; $c++) {
$alist[$c-1] = $args[$c];
}
start $args[0] -argumentlist $alist -verb runas
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment