- @echo off
- setlocal enabledelayedexpansion
- REM set "f1=%~0"
- set "f1=%~f0"
- set "f2=%~dp0删除注释.txt"
- REM set str_eplce=""
- set matchStr=REM
- type %f1% > %f2%
- echo. >> %f2%
- echo ———————————————————————————————— >> %f2%
- for /f %%i in (%f1%) do (
- REM echo !a!
- set a=%%i
- REM set a=!a:^:^:=REM!
- REM find "REM" "!a!" && echo !a!&pause || echo !a! >> %f2%
- REM for /f "delims=:" %%i in ('findstr /v /r !a! "REM"') do echo !a! >> %f2%
- echo %%i | findstr %matchStr% >nul && echo %%i || echo %%i >> %f2%
- )
-
- start %f2%
- pause
-
-
- REM @echo off
- REM for /f "delims=" %%a in (b.txt) do set "%%a=0"
- REM (for /f "delims=" %%a in (a.txt) do (
- REM if not defined %%a echo;%%a
- REM ))>c.txt
-
-
- pause
复制代码 新手的代码难免一堆注释,我想让rem标示的行删除掉,保留其余行,执行后的到的只有这- @echo
- setlocal
- set
- set
- set
- type
- echo.
- echo
- for
- set
- echo
- )
- start
- pause
- pause
复制代码 最长能留8个字符? |