Skip to content

Instantly share code, notes, and snippets.

@MILKTON
Last active December 30, 2020 23:16
Show Gist options
  • Save MILKTON/c737ebad0c691a470403beb034a7148e to your computer and use it in GitHub Desktop.
Save MILKTON/c737ebad0c691a470403beb034a7148e to your computer and use it in GitHub Desktop.
Abrir "aquí" PowerShell como administrador
$menu = 'Abrir PowerShell como Administrador'
$command = "$PSHOME\powershell.exe -NoExit -Command ""Set-Location '%V'"""
'directory', 'directory\background', 'drive' | ForEach-Object { New-Item -Path "Registry::HKEY_CLASSES_ROOT\$_\shell" -Name runas\command -Force | Set-ItemProperty -Name '(default)' -Value $command -PassThru | Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru | Set-ItemProperty -Name HasLUAShield -Value '' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment