PowerShell – Add PowerShell to Context Menu

Here’s a holiday hack for PowerShell. If you would like the ability to right-click on a directory and have PowerShell open to that directory here’s what you do…

  1. Open the registry on the system you want to do this on (regedit.exe)
  2. Navigate to HKEY_CLASSES_ROOT\directory\shell

Image 001

  1. Right-click and create a new key called PowerShellPrompt

Image 002

  1. Rename the Default Data to “PoSH Here” or something similar. This is what will display in the context menu when you right-click

Image 003Image 004

  1. Right-click on the PowerShellPrompt key and create a new key. Name it Command

Image 005

  1. Change the Default data to the following command-line
powershell.exe -noprofile start-process  powershell.exe -verb runas -argumentlist "{ -noprofile -noexit cd %1}

Image 006

  1. Now, when you right-click on a directory, An elevated PowerShell prompt will open at that directory

Image 009

  1. If you want to load your profile when this prompt opens, remove the second “-noprofile” from the command-line
powershell.exe -noprofile start-process  powershell.exe -verb runas -argumentlist "{ -noexit cd %1}"
  1. If you want to have an Icon show up in the Context menu add the following String value to the PowerShellPrompt key

Image 011Image 012
Thanks for reading,



A list of articles/blog posts to review, research, or archive

Thanks for reading,

Visual Studio Code: PowerShell Profile



Microsoft has released a terrific open source, multi-platform code editor called Visual Studio Code. If you want to get started with VS Code, I would recommend watching the videos provided here and then watch this excellent video about replacing PowerShell ISE with Visual Studio Code by Mike Robbins.

What about the PowerShell profile?

While Visual Studio Code can use PowerShell as its terminal, it does not use any previously setup PowerShell profile. In order to create a VS Code PowerShell profile (or VSCPP for short), select the Terminal (make sure it says PowerShell Integrated in the drop down on the right) and type $profile.


In order to create this file, you can type PS>notepad $profile in the terminal. This will open notepad and let you create the file. You can add whatever settings you prefer to in PowerShell. Once you save the profile, hit F1 or Ctrl+Shift+P to bring up the Command Palette and type Reload Window.


When the reload completes, create a new PowerShell file in VS Code and you should see the Terminal switch to PowerShell Integrated and load your newly created VSCPP (this assumes you have installed the PowerShell extension into VS Code).


NOTE: The PowerShell version that is installed as an extension into VS Code, has its own version.


If you have modules, scripts, or functions that have a dependency on a certain version of PowerShell, you will have to change, comment, or remove the dependency in order to use them in Visual Studio Code.

Happy Scripting!