Answers:
供您参考的替代方法:
将关注另存为*.reg
并导入注册表(改编自Sully @ Wilders Security)
Windows注册表编辑器版本5.00 [HKEY_CLASSES_ROOT \ * \ shell \我的菜单] “ Icon” =“ shell32.dll,43” “子命令” =“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1] “ MUIVerb” =“文本编辑器” “ SubCommands” =“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item1] “ MUIVerb” =“记事本++” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item1 \ command] @ =“ C:\\ Program Files \\ npp \\ notepad ++。exe%1” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item2] “ MUIVerb” =“崇高文字” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item2 \ command] @ =“ C:\\ Program Files \\ Sublime Text 3 \\ sublime_text.exe%1” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu2] “ MUIVerb” =“音频” “ SubCommands” =“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu2 \ shell \ item1] “ MUIVerb” =“大胆” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu2 \ shell \ item1 \ command] @ =“ audacity.exe%1”
附录:伪文件夹菜单
另存为 C:\copy.js
函数fnCopyHereJ(src,dest){ var objShell = new ActiveXObject(“ shell.application”); var objFolder = objShell.NameSpace(dest); 如果(objFolder){ objFolder.CopyHere(src); }其他{ WScript.echo(“无效的文件夹:” + dest); } } args = WScript.Arguments; fnCopyHereJ(args(0),args(1));
导入注册表
Windows注册表编辑器版本5.00 [HKEY_CLASSES_ROOT \ * \ shell \我的菜单] “ Icon” =“ shell32.dll,43” “子命令” =“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1] “ Icon” =“ imageres.dll,-113” “ MUIVerb” =“图片” “ SubCommands” =“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item1] “ Icon” =“ shell32.dll,3” “ MUIVerb” =“文件夹1” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item1 \ command] @ =“ wscript C:\\ copy.js%1 C:\\ Users \\ 01 \\ Pictures” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item2] “ Icon” =“ shell32.dll,3” “ MUIVerb” =“文件夹2” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu1 \ shell \ item2 \ command] @ =“ wscript C:\\ copy.js%1 \” C:\\ New Folder \“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu2] “ Icon” =“ imageres.dll,-108” “ MUIVerb” =“音乐” “ SubCommands” =“” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu2 \ shell \ item1] “ Icon” =“ shell32.dll,3” “ MUIVerb” =“文件夹1” [HKEY_CLASSES_ROOT \ * \ shell \ My Menu \ shell \ menu2 \ shell \ item1 \ command] @ =“ wscript C:\\ copy.js%1 C:\\ Users \\ 01 \\ Music” [HKEY_CLASSES_ROOT \ Directory \ shell \ My Menu] “ Icon” =“ shell32.dll,43” “ ExtendedSubCommandsKey” =“ * \\ shell \\我的菜单”
参考
从PowerShell
Folder.CopyHere方法(Windows)通过静态注册表项和ExtendedSubCommandsKey 调用上下文菜单调用Windows复制
@="cmd /c copy %1 NewFolder"
不稳定并且与用户期望不同(%1是文件夹吗?可怕的cmd提示询问是否覆盖?)