效果:
给任意后缀的文件都加了这个菜单项
注册表需导入项:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\editWith] @="" "MUIVerb"="&编辑" "Subcommands"="" [HKEY_CLASSES_ROOT\*\shell\editWith\shell] [HKEY_CLASSES_ROOT\*\shell\editWith\shell\notepad] @="记事本" "Icon"="C:\\Windows\\System32\\notepad.exe" [HKEY_CLASSES_ROOT\*\shell\editWith\shell\notepad\command] @="\"C:\\Windows\\System32\\notepad.exe\" \"%1\"" [HKEY_CLASSES_ROOT\*\shell\editWith\shell\VS code] "Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe" [HKEY_CLASSES_ROOT\*\shell\editWith\shell\VS code\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""
效果图:
注册表:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\cmdShow] @="@shell32.dll,-8506" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmdShow\command] @="cmd.exe /s /k pushd \"%V\""
注意,键名必须是runas
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\runas] @="在此处打开命令窗口(管理员)" "ShowBasedOnVelocityId"=dword:00639bc8 "Extended"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command] @="cmd.exe /s /k pushd \"%V\""
迫不得已用子菜单,因为同一级只能有一个runas项,这个runas被cmd用了,只好弄个子菜单凑合凑合。不过我一般也用不到powershell
效果:
注册表:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin] @="" "Subcommands"="" "MUIVerb"="powershell管理员" "Extended"="" "ShowBasedOnVelocityId"=dword:00639bc8 [HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\shell] [HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\shell\runas] @="Powershell(管理员)" [HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\shell\runas\command] @="powershell.exe -noexit -command Set-Location -literalPath '%V'"
改完后注册表结构: