求助:批处理多个字段替换出错:包括!和换行符^P字段如何替换?
替换a\b\c三个字段,前后有符号,由于是!和换行符所以不好处理,请教如何实现- @echo off & setlocal enabledelayedexpansion
- for /f "tokens=*" %%i in (1.log) do (
- if "%%i"=="" (echo.) else (set "line=%%i" & call :chg)
- )>>new_1.txt
- pause
- exit
-
- :chg
- rem 这个是保留空行
- set "line=!line:,,a!!^p=,a.!"
- set "line=!line:,,b!!^p=,b.!"
- set "line=!line:,c!!=,c.!"
- rem 替换
- echo !line!
- goto :eof
复制代码
|