为什么REG DELETE命令在此批处理脚本中失败?

时间:2017-02-02 18:39:44

标签: windows batch-file

所以我找到了一个脚本,将Sublime Text添加到资源管理器的上下文菜单中,但我不再需要此功能。我在将其添加到注册表时使用了批处理脚本,现在当我尝试使用REG ADD替换为REG DELETE的相同脚本时,我收到语法错误。

这是剧本;我该如何纠正这个问题?

@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe

rem add it for all file types
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2"         /t REG_SZ /v "" /d "Open with Sublime Text 2"   /f
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2"         /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f

rem add it for folders
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2"         /t REG_SZ /v "" /d "Open with Sublime Text 2"   /f
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2"         /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
pause

1 个答案:

答案 0 :(得分:2)

{strong}创建新注册表项时,<?php $newterm = $_POST['nwterm']; if($newterm == 'bio'){ echo "Request recieved This is the new data"; }else{ echo "no data recieved"; } ?> /t选项分别指定值的类型和值中的数据。它们与/d无效。

REG DELETE的有效操作(与您尝试执行的操作相关)是:

1。删除整个注册表项:

REG DELETE

2。删除注册表项中的特定值:

REG DELETE HKLM\Sub\Key\Here