Create Open Powershell Here Context Menu Entry with Powershell
I saw this great post a few days ago about adding a Open Powershell context menu entry using regedit. I thought it was really cool, but quickly decided why not create it using POWERSHELL!!!
I should note, you need to have powershell running as an admin for this…
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT new-item -path HKCR:directory/shell/powershell new-item -path HKCR:directory/shell/powershell/command set-item -path HKCR:directory/shell/powershell -value "Open PowerShell Here" set-item -path HKCR:directory/shell/powershell/command -value "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"
Here is what it looks like when it is all said and done
This is was also great for me but I am still learning powershell, especially the registry stuff, so it was just good practice for a quick script.
And if you haven’t checked out the original post
Add Open Powershell to Context Menu
References:
Working with Registry Keys
Powershell.com Chaprter 16 Registry
You can omit line 3 (new-item -path HKCR:directory/shell/powershell) if you use -Force switch in line 4:
new-item -path HKCR:directory/shell/powershell/command -force