Am dat aici o soluție pentru sudo, un snippet de 3 rânduri:
function sudo() {
$curDir = (Get-Location).path
powershell -command "Start-Process cmd -ArgumentList '/c cd /d $curDir && $args & pause' -Verb runas"
}
Noutatea este că ai opțiunea să rulezi inline, nu într-o fereastră nouă, iar modul în care se întâmplă asta este foarte interesant:
In these configurations, sudo.exe will launch a new elevated process, an elevated sudo.exe process, and the original unelevated sudo.exe will establish an RPC connection with the new elevated process. In other words, information is passed from the unelevated sudo instance to the elevated one.