本帖最后由 WHY 于 2023-2-23 19:58 编辑
注册表默认值数据类型为REG_SZ
包含有 %SystemRoot% 变量的类型应该是 REG_EXPAND_SZ
可以直接用批处理命令:- @echo off
- reg add "HKLM\SOFTWARE\Classes\Folder\Shell\CMDCMD" /ve /d "CMDCMD"
- reg add "HKLM\SOFTWARE\Classes\Folder\Shell\CMDCMD\Command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\System32\Cmd"
- pause
复制代码 如果一定要用reg文件导入,可以这样:
打开 PowerShell 控制台窗口,输入命令:- ([char[]]'%SystemRoot%\System32\Cmd'|%{([int]$_).ToString('X')+',00'}) -join ','
复制代码 得到一串值:
25,00,53,00,79,00,73,00,74,00,65,00,6D,00,52,00,6F,00,6F,00,74,00,25,00,5C,00,53,00,79,00,73,00,74,00,65,00,6D,00,33,00,32,00,5C,00,43,00,6D,00,64,00
把这串值写入reg文件:- Windows Registry Editor Version 5.00
-
- [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\Shell\CMDCMD]
- @="CMDCMD"
- [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\Shell\CMDCMD\Command]
- @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6D,00,52,00,6F,00,6F,00,74,00,25,00,5C,\
- 00,53,00,79,00,73,00,74,00,65,00,6D,00,33,00,32,00,5C,00,43,00,6D,00,64,00
复制代码
|