回复 3# qixiaobin0715
保留空行和保留英文感叹号-方法1.bat- @echo off
- cd /d "%~dp0"
- (for /f "tokens=1* delims=:" %%a in ('findstr /n .* "1.txt"') do (
- set "str=%%b"
- setlocal enabledelayedexpansion
- if "%%b" neq "" (
- set "str=!str:ABC=123!"
- set "str=!str:XYZ=AFK!"
- )
- echo,!str!
- endlocal
- ))>"2.txt"
复制代码 保留空行和保留英文感叹号-方法2.bat- @echo off
- cd /d "%~dp0"
- (for /f "delims=" %%a in ('findstr /n .* "1.txt"') do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- set "str=!str:ABC=123!"
- set "str=!str:XYZ=AFK!"
- echo,!str:*:=!
- endlocal
- ))>"2.txt"
复制代码
|