本帖最后由 happy886rr 于 2016-4-3 20:07 编辑
回复 5# wang6542975
不推荐批处理解决文本替换。各种批处理方案都有一些缺点- @echo off
- (for /f "delims=" %%a in ('type "test.txt"^|findstr /n .*') do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- set "str=!str:*:=!"
- set "str=!str:no dst=no src-address=192.168.16.0/24 dst!"
- echo;!str!
- endlocal
- ))>$ &move $ "test.txt"
复制代码
|