- cd /d %~dp0
- setlocal enabledelayedexpansion
- set strNew=
- for /f "delims=*" %%m in ('type "C:\1.txt"') do (
- for /f "delims=*" %%a in ('dir/b/s *.htm *.txt') do (
- for /f "delims=*" %%i in ('type "%%a"') do (
- set var=%%i
- set "var=!var:%%m=%strNew%!"
- if defined var (
- echo !var!!>>%%a.bk
- )
- )
- move "%%a.bk" "%%a"
- )
- )
复制代码 我是想用C:\1.txt里每一换去替换 当前文件夹*.htm *.txt的所有文件里的内容 但是需要每一行去替换太慢了,有没有快点的方法呢 |