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

Working with Registry Keys Chaprter 16 Registry

4 thoughts on “Create Open Powershell Here Context Menu Entry with Powershell”

    1. That would be cool. I believe it would be easy enough to do as well. If you do a “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe C:script.ps1” I believe that would do it. Haven’t tested it myself but that is exactly how I have a few scheduled tasks setup on some servers.

Leave a Reply

%d bloggers like this: