Windows – How to replace PowerShell 5 with PowerShell 6 as the system default

powershellwindowswindows-explorer

I currently have both installed in Windows 10, and have no problem opening either from the start menu. They can be used side-by-side.

However, I have need trick that when in a folder in Windows Explorer, if I hit Alt+F, the menu that pops up including a choice to Open Windows PowerShell. That menu item has twp hotkeys, R and S, and hitting S split the menu item into 2: one to open PowerShell in Admin mode and one to open it with normal privilege.

So to open a PowerShell console, in admin mode, from a folder in Explorer, I just hit Alt+F,S,A, and bang, Powershell 5 opens.

I would like to know if and how I can trick this menu or hotkey combo to open PowerShell 6 instead.

Best Answer

That is a lot of work, to just run PoSH as an Admin. Just set you PoSH shortcuts to Run As Admin via the shortcut properties, in the Advanced section.

Copy and paste those shortcuts wherever is prudent for you. Taskbar, Desktop, SendTo Menu.

Use the registry to set pwsh.exe as the Right Click Explorer Context Menu option.

Add PowerShell to Windows Explorer Context Menu in Windows 10 https://www.petri.com/add-powershell-windows-explorer-context-menu-windows-10

You do know you can start PoSH in any folder from explorer, simply by clicking the folder the tap F4 and just type powershell or pwsh, or cmd, and they will start from the selected folder. No RegHacks required or other key binding creation and you include in your profile code to auto elevate you to admin.

Related Question