我有这个脚本,脚本工作正常。除了一部分。我试图在每次查询后返回错误级别以确定我的错误级别。我知道我的语法错误,请帮忙。
@echo off
setlocal enabledelayedexpansion
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 (
IF !errorlevel!==0 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
ECHO [PW-MOD] reg delete "%ports%" /v "%%I" /f
)
)
[Dk 68 61 63 6b
根据评论编辑] [重新编辑 PW 以加入断线并禁用可能具有破坏性的指令'reg delete'
]