Shift + right-click
shows a context menu with additional entries such as Open command window here
.
To add Open powershell here
with and without elevated privileges:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\ps] @="Open powershell here" [HKEY_CLASSES_ROOT\Directory\shell\ps\command] @="C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'" [HKEY_CLASSES_ROOT\Directory\shell\Runas] @="Open admin powershell here" [HKEY_CLASSES_ROOT\Directory\shell\Runas\Command] @="C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'" [HKEY_CLASSES_ROOT\Drive\shell\ps] @="Open powershell here" [HKEY_CLASSES_ROOT\Drive\shell\ps\command] @="C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'" [HKEY_CLASSES_ROOT\Drive\shell\runas] @="Open powershell admin here" [HKEY_CLASSES_ROOT\Drive\shell\runas\command] @="C:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"
Keys having runas
in their names are the ones that will trigger elevated privileges. So yes, it seems we can only map one elevated command per HKEY_CLASSES_ROOT
key…