Skip to content

Instantly share code, notes, and snippets.

@lucianovalenca
Last active December 28, 2020 15:54
Show Gist options
  • Save lucianovalenca/280444bd904ad5d8e197043a7d6a3b5a to your computer and use it in GitHub Desktop.
Save lucianovalenca/280444bd904ad5d8e197043a7d6a3b5a to your computer and use it in GitHub Desktop.
After checking multiple tutorials I had to take pieces from each of the following to get this to work on my Win10 system:
* https://www.howtogeek.com/165268/how-to-add-open-powershell-here-to-the-context-menu-in-windows/
* https://www.tenforums.com/tutorials/60175-open-powershell-window-here-context-menu-add-windows-10-a.html
Basically it uses the steps from the first article, but under the `background` path from the second article.
Neither article on its own worked for me.
Steps:
1. Open regedit and go to path `HKEY_CLASSES_ROOT\Directory\background\shell`.
2. Create new key `powershellmenu`.
3. Change the `Default` value of the `powershellmenu` key to *Open in PowerShell*. (or whatever)
4. Create new key `command` under `powershellmenu`.
5. Change the `Default` value of the `command` key to:
C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'
6. Right-click on `powershellmenu` key and select `Permissions`, then set permissions to `Full control` for the Administrators group. (or whatever group/user)
Then try right-clicking in some folder and it should work.
------------------------
I had to change the data in command (default) to
`PowerShell -windowstyle hidden -Command "Start-Process cmd -ArgumentList '/s,/k,pushd,%V && start PowerShell && exit' -Verb RunAs"`
if chocolatey is installed a lazy sysadmin could also simply run:
`choco install powershellhere`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment