如何将批处理脚本转换为注册表上下文菜单文件REG_MULTI_SZ

时间:2019-05-10 13:50:53

标签: batch-file registry batch-processing

我想将多行批处理脚本转换为REG_MULTI_SZ命令。

我想将其用作文件资源管理器中的上下文菜单项,以杀死所有未响应的任务。我可以将其与下面的注册表项命令一起使用。

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\KillNotResponding]
"MUIverb"="Kill Tasks Not Responding"
"Position"="Bottom"
"Icon"="shell32.dll,-240"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\KillNotResponding\command]
@="cmd /k taskkill /f /fi \"Status EQ Not Responding\" && timeout /t 2 && exit"

我正在尝试执行此操作,因为编写多行批处理文件比将所有内容放在一行REG_SZ上要容易得多。

我正在尝试使用以下批处理脚本作为REG_MULTI_SZ。

@echo off &setlocal
set prompt=$S$H
:: Kill all tasks not responding ::
cecho {0A} &
start cmd /k taskkill /f /fi \"status EQ Not Responding\" &
timeout /t 2 nul &
endlocal
exit /b

我知道REG_MULTI_SZ仅使用HEX(7)。

这是上面的批处理脚本,已转换为十六进制(7)

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\KillNotResponding]
@="Kill Tasks Not Responding"
"Position"="Bottom"
"Icon"="shell32.dll,-240"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\KillNotResponding\command]
"Kill Tasks Not Responding"=hex(7):40,00,65,00,63,00,68,00,6F,00,20,00,6F,00,\
       66,00,66,00,00,00,69,00,66,00,20,00,2F,00,69,00,20,00,6E,00,6F,00,74,00,\
     20,00,22,00,25,00,31,00,22,00,20,00,3D,00,3D,00,20,00,22,00,6D,00,61,00,\
     78,00,22,00,20,00,73,00,74,00,61,00,72,00,74,00,20,00,2F,00,6D,00,61,00,\
     78,00,20,00,63,00,6D,00,64,00,20,00,2F,00,63,00,20,00,25,00,30,00,20,00,\
     6D,00,61,00,78,00,20,00,26,00,20,00,65,00,78,00,69,00,74,00,20,00,2F,00,\
     62,00,00,00,73,00,65,00,74,00,6C,00,6F,00,63,00,61,00,6C,00,00,00,00,00,\
     73,00,65,00,74,00,20,00,70,00,72,00,6F,00,6D,00,70,00,74,00,3D,00,24,00,\
       53,00,24,00,48,00,00,00,00,00,3A,00,3A,00,20,00,4B,00,69,00,6C,00,6C,00,\
     20,00,61,00,6C,00,6C,00,20,00,74,00,61,00,73,00,6B,00,73,00,20,00,6E,00,\
         6F,00,74,00,20,00,72,00,65,00,73,00,70,00,6F,00,6E,00,64,00,69,00,6E,00,\
         67,00,20,00,3A,00,3A,00,00,00,63,00,65,00,63,00,68,00,6F,00,20,00,7B,00,\
     30,00,41,00,7D,00,20,00,26,00,00,00,73,00,74,00,61,00,72,00,74,00,20,00,\
         63,00,6D,00,64,00,20,00,2F,00,6B,00,20,00,74,00,61,00,73,00,6B,00,6B,00,\
         69,00,6C,00,6C,00,20,00,2F,00,66,00,20,00,2F,00,66,00,69,00,20,00,5C,00,\
         22,00,73,00,74,00,61,00,74,00,75,00,73,00,20,00,45,00,51,00,20,00,4E,00,\
         6F,00,74,00,20,00,52,00,65,00,73,00,70,00,6F,00,6E,00,64,00,69,00,6E,00,\
         67,00,5C,00,22,00,20,00,26,00,00,00,74,00,69,00,6D,00,65,00,6F,00,75,00,\
         74,00,20,00,2F,00,74,00,20,00,32,00,20,00,26,00,00,00,00,00,65,00,6E,00,\
         64,00,6C,00,6F,00,63,00,61,00,6C,00,00,00,65,00,78,00,69,00,74,00,20,00,\
         2F,00,62,00,00,00,00,00

0 个答案:

没有答案