How did I add PowerShell 7 to the File Explorer context menu in Windows 10?

I have implemented it similar to cmd.
Also, I adapted existing Windows Registry keys for the built-in Powershell 5.1 instead of creating new registry entries from scratch.

Step 0

Install PowerShell 7.

Step 1

Take ownership on the KEY_CLASSES_ROOT\Directory\Background\shell\Powershell branch of Windows Registry.
It is needed to be able to edit the registry entries mentioned below.

Step 2

Delete the «ShowBasedOnVelocityId» key from the HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell branch of Windows Registry:
2023-04-29--00-44-24
askvg.com/windows-10-tip-restore-open-command-window-here-option-in-shiftright-click-menu

Step 3

Delete «Extended» key:
2023-04-29--00-48-31

Step 4

Replace the Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\Powershell\command key's value from

powershell.exe -noexit -command Set-Location -literalPath '%V'

to

pwsh -noexit -command Set-Location -literalPath '%V'

2023-04-29--01-03-06

  • powershell.exe is PowerShell 5.1
  • pwsh is PowerShell 7 (it is located at %ProgramFiles%\PowerShell\7\pwsh.exe)

Step 5

Add the «Icon» key (similar to cmd):
2023-04-29--02-25-04

2023-04-29--02-28-22

Step 6

Rename «Open PowerShell window here» to «PowerShell» (similar to cmd):
2023-04-29--02-33-14

2023-04-29--02-34-11

Step 7

Set up the appearance.

How did I add cmd to the File Explorer context menu in Windows 10?