
批處理命令findstr/v/g的問題的困惑
- @echo off
- findstr /v /g:需要刪除內容1.txt a.txt >c.txt
- pause >nul
nclick="copycode($('code0'));">復制代碼
++++++++++++++++++++++++++++++++++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_MACHINESYSTEMCurrentControlSetservicesMpsSvcParametersPortKeywordsDHCP /v Collection /t REG_BINARY /d /f
- Reg.exe add HKEY_USERSS-1-5-21-3291519012-2868546545-2290023086-500Console /v WindowPosition /t REG_DWORD /d 9830700 /f
- Exit
- :IsAdmin
- Reg.exe query HKUS-1-5-19Environment
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
nclick="copycode($('code1'));">復制代碼
++++++++++++++++++++++++++++++++需要刪除內容1.txt:
- Title Reg Converter v1.1 & Color 1A
- cd %systemroot%system32
- call :IsAdmin
- REM ; 由 Total Uninstall 產生
- REM ;【窗口位置:“左300”、“上150”】
- :IsAdmin
- Reg.exe query HKUS-1-5-19Environment
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
nclick="copycode($('code2'));">復制代碼
++++++++++++++++++++++++++++++++++++++++++++++運行后得到的c.txt@Echo Offcd %systemroot%system32——————————這個為什么沒有刪除?Reg.exe add HKEY_LOCAL_MACHINESYSTEMCurrentCo
ntrolSetservicesMpsSvcParametersPortKeywordsDHCP /v Collection /t REG_BINARY /d /fReg.exe add HKEY_USERSS-1-5-21-3291519012-2868546545-2290023086-500Co
nsole /v WindowPosition /t REG_DWORD /d 9830700 /fExitReg.exe query HKUS-1-5-19Environment——————————這個為什么沒有刪除?++++++++++++++++++++++++++++++++++++++++++++++++++++++++++這個問題困惑了很久,不知道為什么會這樣?+++++++++++++++++++++++++++我希望得到的結果是:
- @Echo Off
- Reg.exe add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesMpsSvcParametersPortKeywordsDHCP /v Collection /t REG_BINARY /d /f
- Reg.exe add HKEY_USERSS-1-5-21-3291519012-2868546545-2290023086-500Console /v WindowPosition /t REG_DWORD /d 9830700 /f
- Exit
nclick="copycode($('code3'));">復制代碼
【實際上我通過第2次操作,已經能夠實現上面的結果,只是想知道在哪里出現了問題】
- findstr /v /g:需要刪除內容2.txt c.txt >d.txt
nclick="copycode($('code4'));">復制代碼