删除使用删除章注册表项 [英] Deleting Registry entries using reg delete

查看:145
本文介绍了删除使用删除章注册表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个批处理命令用来删除注册表值章删除。我遇到的问题是,我无法删除该值。下面是我想:

I am trying to delete registry values using reg delete in a batch command. The problem I am having is that I can't delete the value. Here is what I am trying:

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\" /v C:\convertdoc\output\SilentPrintTemp\126017829image-gif3.ps

在理想情况下,我想删除与所有条目:

Ideally I wanna remove all entries with:

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\" /v  C:\convertdoc\output\SilentPrintTemp\*.ps

我在几个不同的方法和不同的参数尝试过。通常的双,在键的末端停止该命令。所以,也许我的语法有错吗?

I have tried it in a few different ways and with different parameters. Normally the double "" stops the command at the end of the key. So maybe my syntax is wrong?

推荐答案

编辑:

的.bat 扩展名保存这并运行它:

Save this with a .bat extension and run it:

@echo off
setlocal
set "ports=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports"

rem get only the first token of each line of "reg query"
for /f %%I in (
    'reg query "%ports%"'
) do (
    echo(%%I | findstr /i "c:\\convertdoc\\output\\silentprinttemp\\.*\.ps" >NUL && (
        rem (if "findstr" didn't exit with an abnormal error code)
        echo Deleting item %%I
        reg delete "%ports%" /v "%%I" /f
    )
)

这篇关于删除使用删除章注册表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆