Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何使用windows上下文菜单创建新文件_Batch File_Registry_Contextmenu - Fatal编程技术网

Batch file 如何使用windows上下文菜单创建新文件

Batch file 如何使用windows上下文菜单创建新文件,batch-file,registry,contextmenu,Batch File,Registry,Contextmenu,使用注册表,我使用下面的代码在windows上下文菜单中创建了一个子菜单 [HKEY_CLASSES_ROOT\DesktopBackground\Shell\Power Menu] "MUIVerb"="Matt's Usefull Tools" "SubCommands"="batmode;logoff;switch;sleep;hibernate;restart;safemode;shutdown;hybridshutdown" "Icon"="C:\\Users\\Matthew\\Do

使用注册表,我使用下面的代码在windows上下文菜单中创建了一个子菜单

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\Power Menu]
"MUIVerb"="Matt's Usefull Tools"
"SubCommands"="batmode;logoff;switch;sleep;hibernate;restart;safemode;shutdown;hybridshutdown"
"Icon"="C:\\Users\\Matthew\\Downloads\\Hacker.ico"
"Position"="bottom"
现在我希望能够单击我设置的命令,然后让它在我右键单击的位置创建一个.bat文件,我知道您可以通过使用代码编辑.bat注册表将其添加到“新建”子菜单

[HKEY_CLASSES_ROOT\.bat\ShellNew]
 "NullFile"=""

现在可以在我的子菜单中实现吗

我只能通过以下命令来实现此功能: CMD.exe/c@ECHO.>%V\New File.bat

在HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\Shell\batfile\command下

其中“batfile”必须是您的“子命令”之一

问题是,这将始终在当前位置(例如桌面)创建“New File.bat”。 如果有一个现有的“newfile.bat”,它只会覆盖它。 如果您使用CMD.exe/c@ECHO.>>“%V\New File.bat”并且存在“New File.bat”的现有副本,它只会在文件中添加空白

我不知道从“命令”调用“ShellNew”的方法

也许这会有帮助

编辑: 哎呀。。。刚才看到这是一个一年前的问题^^ 无论如何,它可能会帮助其他人。:)