- @echo off
- findstr /v /g:需要删除内容1.txt "a.txt" >"c.txt"
- pause >nul
复制代码 ++++++++++++++++++++++++++++++++++
a.txt内容是:- @Echo Off
- Title Reg Converter v1.1 & Color 1A
- cd %systemroot%\system32
- call :IsAdmin
-
- REM ; 由 Total Uninstall 产生
- REM ;【窗口位置:“左300”、“上150”】
- Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MpsSvc\Parameters\PortKeywords\DHCP" /v "Collection" /t REG_BINARY /d "" /f
- Reg.exe add "HKEY_USERS\S-1-5-21-3291519012-2868546545-2290023086-500\Console" /v "WindowPosition" /t REG_DWORD /d "9830700" /f
- Exit
-
- :IsAdmin
- Reg.exe query "HKU\S-1-5-19\Environment"
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
复制代码 ++++++++++++++++++++++++++++++++
需要删除内容1.txt:- Title Reg Converter v1.1 & Color 1A
- cd %systemroot%\system32
- call :IsAdmin
-
- REM ; 由 Total Uninstall 产生
- REM ;【窗口位置:“左300”、“上150”】
-
- :IsAdmin
- Reg.exe query "HKU\S-1-5-19\Environment"
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
复制代码 ++++++++++++++++++++++++++++++++++++++++++++++
运行后得到的c.txt
@Echo Off
cd %systemroot%\system32——————————这个为什么没有删除?
Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MpsSvc\Parameters\PortKeywords\DHCP" /v "Collection" /t REG_BINARY /d "" /f
Reg.exe add "HKEY_USERS\S-1-5-21-3291519012-2868546545-2290023086-500\Console" /v "WindowPosition" /t REG_DWORD /d "9830700" /f
Exit
Reg.exe query "HKU\S-1-5-19\Environment"——————————这个为什么没有删除?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
这个问题困惑了很久,不知道为什么会这样?
+++++++++++++++++++++++++++
我希望得到的结果是:- @Echo Off
- Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MpsSvc\Parameters\PortKeywords\DHCP" /v "Collection" /t REG_BINARY /d "" /f
- Reg.exe add "HKEY_USERS\S-1-5-21-3291519012-2868546545-2290023086-500\Console" /v "WindowPosition" /t REG_DWORD /d "9830700" /f
- Exit
复制代码 【实际上我通过第2次操作,已经能够实现上面的结果,只是想知道在哪里出现了问题】- findstr /v /g:需要删除内容2.txt "c.txt" >d.txt
复制代码
|