本帖最后由 andyrave 于 2011-3-20 11:44 编辑
- @echo off & setlocal enableDelayedExpansion
- set file=1.txt
- set "file=%file:"=%"
- for %%i in ("%file%") do set file=%%~fi
- rem replaced=空格
- set replaced=
- set all=
- for /f "delims=" %%i in ('type "%file%"') do (
- set str=%%i
- set "str=!str:%replaced%=%all%!"
- echo !str!>>"%file%"_tmp.txt
- )
- move "%file%"_tmp.txt "%file%" 1>nul 2>nul
复制代码
|