似乎纯bat批处理下只能导入文件,见https://stackoverflow.com/questions/25414510/how-to-add-a-reg-none-empty-value-using-batch/25474206。zero-length binary value(数值是零的二进制位值)且类型为REG_NONE,是难点。- echo Windows Registry Editor Version 5.00>tmp.reg
- echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SWF\OpenWithProgids]>>tmp.reg
- echo "ShockwaveFlash.ShockwaveFlash"=hex(0):>>tmp.reg
- reg import tmp.reg
复制代码 用PowerShell测试成功,如下- [Microsoft.Win32.Registry]::SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SWF\OpenWithProgids","ShockwaveFlash.ShockwaveFlash",[byte[]]@(),-1)
复制代码 参考自https://social.technet.microsoft.com/Forums/office/en-US/c3a79b17-e0d3-481c-9e8a-90e9e6d9d867/set-registry-value-to-0 |