Skip to content

Instantly share code, notes, and snippets.

@tahir-hassan
Last active November 29, 2019 18:11
Show Gist options
  • Save tahir-hassan/caa491bb323419649c897d1f2d82b2f4 to your computer and use it in GitHub Desktop.
Save tahir-hassan/caa491bb323419649c897d1f2d82b2f4 to your computer and use it in GitHub Desktop.
Explorer Context Menu for opening PowerShell in that directory. This also includes elevated options. Base on https://stackoverflow.com/a/24603961/288393
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenPowerShellHere]
@="Open PowerShell here"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenPowerShellHere\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
[HKEY_CLASSES_ROOT\Directory\shell\OpenPowerShellHere]
@="Open PowerShell here"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_CLASSES_ROOT\Directory\shell\OpenPowerShellHere\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
[HKEY_CLASSES_ROOT\Drive\shell\OpenPowerShellHere]
@="Open PowerShell here"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_CLASSES_ROOT\Drive\shell\OpenPowerShellHere\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenPowerShellHereElevated]
@="Open PowerShell here (elevated)"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenPowerShellHereElevated\command]
@="powershell.exe -NoProfile -Command Start-Process -verb runAs -ArgumentList '-NoExit','cd','%V' powershell"
[HKEY_CLASSES_ROOT\Directory\shell\OpenPowerShellHereElevated]
@="Open PowerShell here (elevated)"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_CLASSES_ROOT\Directory\shell\OpenPowerShellHereElevated\command]
@="powershell.exe -NoProfile -Command Start-Process -verb runAs -ArgumentList '-NoExit','cd','%V' powershell"
[HKEY_CLASSES_ROOT\Drive\shell\OpenPowerShellHereElevated]
@="Open PowerShell here (elevated)"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_CLASSES_ROOT\Drive\shell\OpenPowerShellHereElevated\command]
@="powershell.exe -NoProfile -Command Start-Process -verb runAs -ArgumentList '-NoExit','cd','%V' powershell"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment