Open With CMD, PowerShell, Linux (WSL)
-
run as administrator:
--_1_permissions.cmd.
it usesPsExec64.exe(https://learn.microsoft.com/en-us/sysinternals/downloads/psexec)
andSetACL.exe(https://helgeklein.com/setacl)
to run asSYSTEMand change ownership fromTrustedInstallertoAdministrators,
ignore warnings, some of the keys do not exist on your machine. that's fine. -
run as administrator:
--_2_cleanup.cmd.
it importscleanup_cmd.reg,cleanup_powershell.reg,cleanup_wsl.reg
which have delete instructions, those too, include some keys that do not exist on your machine. that's fine too.
I advise you to use the newer option 2 - sub menu
you can choose to manually double click either of those:
option1__same_level__cmd__install.regoption1__same_level__powershell__install.regoption1__same_level__wsl__install.reg
which will bring them back, using normal ownership,
without Extended meaning they will not require you to hold SHIFT,
and without ShowBasedOnVelocityId and HideBasedOnVelocityId,
meaning they will not be hidden or shown unexpectedly in some cases.
also, they will have the icon of their main execute.
the items will be just like before, spread across other context-menu items,
sorted by their name, meaning cmd and powershell will be on top,
and wsl will be last, and probably have few other items in-between.
- double click each of those, to make sure you have removed items from option 1.
option1__same_level__cmd__uninstall.regoption1__same_level__powershell__uninstall.regoption1__same_level__wsl__uninstall.reg
-
double click
option2__sub_level__command_prompts__base__install.reg
it will install an empty menu withoutcmd,powershell, orwsl,
and will add the link toDirectory,Directory\Background, andDrive. -
now, choose either of those to populate (add items) to the menu.
option2__sub_level__command_prompts__cmd__install.regoption2__sub_level__command_prompts__powershell__install.regoption2__sub_level__command_prompts__wsl__install.reg
you can uninstall them later using each uninstall.reg file.
if you wish to uninstall the menu itself,
use option2__sub_level__command_prompts__base__uninstall.reg.
some information...
- if you have installed a terminal/console from the Microsoft Store or anything that uses
SYSTEMas trusted installer,
and not just admin (most Microsoft products),
query the entries, useregedit.exeorRegistry WorkShop(http://www.torchsoft.com/en/rw_information.html),
export the old keys, add icon entry, and remove theextendedandhideandshowentries.
if you are able to use Registry WorkShop as admin (you can even force open keys),
or run it as SYSTEM using PsExec64.exe (https://learn.microsoft.com/en-us/sysinternals/downloads/psexec)
and change ownership/permissions manually, do it.
otherwise add the keys to __1_permissions.cmd
note the redundancy of having HKLM, HKCU, and HKCR
so SetACL.exe (https://helgeklein.com/setacl) will do the hard part for you.
then copy cleanup_cmd.reg rename it to note your terminal/console,
and make sure it has all the variations...
it is a lot safer than using REG.exe delete commands.
then choose either option1__same_level__cmd__install.reg or option2__sub_level__command_prompts__cmd__install.reg as your "template".
rename, add your commands and make an uninstall.reg .
lets take a look at this for a second
[........\my_menu]
@="" ; mandatory! you should not specify default value. as this is also used for command in simpler cases, it makes the entry show as non-menu.
"MUIVerb"="Command Prompts" ; mandatory! specify here the caption. you can also use "MUIVerb"="@shell32.dll,-8508" to take from shell32.dll.mui under whatever language your windows has installed, the value from the string-table. which will change automatically as the OS language will change.
"MUIVerb.1033"="Command Prompt" ; en-US
"MUIVerb.en-US"="Command Prompts" ; en-US
"MUIVerb.2057"="Command Prompts" ; en-GB
"MUIVerb.en-GB"="Command Prompts" ; en-GB
"MUIVerb.1037"="שורת פקודה" ; he-IL
"MUIVerb.he-IL"="שורת פקודה" ; he-IL
"Icon"="cmd.exe,0" ; optional. adds an icon to the menu.
;"Position"="Top" ; optional. designed to order entry near bottom of entries. Bottom is near the "new..." part. Top is near "views"
"SeparatorBefore"="" ; optional. adds _____ before. only works for menus. for commands you need to use CommandFlags (bitwise OR) - ; optional. 0x20 before, 0x40 after. both: 0x60 (0x20 OR 0x40) - in browser console you can use "0x" + (0x20 | 0x40).toString(16) to get the 0x60 (that's 96 decimal). note that Windows will merge separators.
"SeparatorAfter"="" ; optional. adds _____ after. only works for menus.
"subcommands"="" ; mandatory! empty string, as the commands are given in here direc@=""menus should not have default value, since it can be used as shorthand of a command.
you can either specify it having empty string, orDELETEinstruction, using@=-"subcommands"="", essentially it can "take" and key from around the registry.. I think. empty is fine, when the sub items are written below it.- if you either put a default value or forget the subcommands, your menu will just show as an item.
"Position"=-Top,Bottomwas mixing with the "organic" items so I kept it in the middle (commented-out)."SeparatorBefore"="","SeparatorAfter"="" - those are unique to menus, and can not be used anywhere else, commands (sub items that are either having default value or sub keycommand) would have to includeCommandFlagswhich can include the hexadecimal value of either0x20for separator before,0x40for after, or joining both using bitwiseORto0x60(96 decimal). there are other stuff you can combine into it... and you can use javascript from your browser for quick calculation..."0x" + (0x20 | 0x40).toString(16)`. the context-menu will merge separators so that's fine, you won't make a mess.
special paths.
cygwin and wsl have "special" mapping for linux like compatible paths,
wsl can handle the conversion itself, and for cygwin you can use either cygpath
or just do it yourself using string manipulation, and a small windows batch file,
converting from C:\Foo\Bar to /cygdrive/c/Foo/Bar (lower drive letter, forward slash, /cygdrive prefix).
launch it directly in bash or use mintty ( https://github.com/mintty/mintty )
you can probably get a quick batch file from any simple A.I. chat app ( https://duck.ai/chat ).
option 2 - sub menu was a little tricky (developer notes)..
first I defined a new "menu", under HKEY_CURRENT_USER\Software\Classes\ (I added another level \ContextMenus\ just to be options to add other menus in the future),
then all HKEY_CURRENT_USER\Software\Classes\Directory, HKEY_CURRENT_USER\Software\Classes\Directory\Background, and
HKEY_CURRENT_USER\Software\Classes\Drive - just need to include "ExtendedSubCommandsKey"="ContextMenus\\menu_command_prompts"
which is a path relative to the user classes, without HKEY_CURRENT_USER\Software\Classes
some of the older notes:
- the context-menu entries are created, explicitly, to the current user.
- they are created like normal registry keys, so you can edit then normally afterwards.
- modification: for
wsl- I have added--distribution Ubuntu, explicitly. - modification: I have added for each, an icon based on the main executable (cmd, powershell, wsl).
- modification: I have removed (commented-out)
Extendedso plain right click will show the entries. - modification: I have removed (commented-out)
ShowBasedOnVelocityIdandHideBasedOnVelocityId, since sometimes they hide the entries.
what YOU can do:
- edit
set_...regfiles open them with a decent editor such as notepad++. - if you so wish, uncomment
Extendedlines, save, double click the file to apply it. it will make the entry only be shown when holding SHIFT. - manually change the lines
@="@shell32.dll,-8506", replacing@shell32.dll,-8506with your own text. in whatever language you want. - change command lines, for example
@="wsl.exe --distribution Ubuntu --cd \"%V\""you can re-remove--distribution Ubuntuor change the distribution name.
- you don't have to reboot, nor restart
explorer.exeall changes can be done right away by embedding the various.regfiles (double click. - make sure to edit the
.regfiles usingnotepad2ornotepad++or anything which explicitly sets the Windows-EOL (end of line).
here are related registry tweaks you might be looking for copy to .reg file and double click to embed:
;;----------------------------------------------- restores normal right-click context menu. effects W11.
[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32]
@=""<4>make sure all your items are shown even if you select a lot of files and folders
;;----------------------------------------------- allow showing context-menu items, even if 100 files are selected (default is 15 - "MultipleInvokePromptMinimum"=dword:0000000F or "MultipleInvokePromptMinimum"=- )
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer]
"MultipleInvokePromptMinimum"=dword:00000064

