如题所示,现在有类似的TXT文档,内容为“中国:1234中国:5678中国:9089”,希望将里面的“中国:”替换为换行符,成为下面的样子:
1234
5678
9089
在百度上找到一个批处理文件,如下:- @echo off
- (for /f "delims=" %%a in (a.txt) do (
- call :replace_str "%%a"
- ))>a.log
-
- pause&exit
- :replace_str
- setlocal&set "str=%~1"
- echo;%str:中国=&echo %
- endlocal&goto:eof
复制代码 但是运行结果为
ECHO 处于关闭状态。
1234
ECHO 处于关闭状态。
5678
ECHO 处于关闭状态。
9089
哪位高人帮忙指点一下,批处理小白,不懂,谢谢 |