感谢大家对我问题的关心和帮助.
再次谢谢!!!
好人一生平安.
[ Last edited by pengfei on 2006-7-26 at 21:38 ]
再次谢谢!!!
好人一生平安.
[ Last edited by pengfei on 2006-7-26 at 21:38 ]
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
Originally posted by namejm at 2006-7-26 19:10:
@echo off
setlocal enabledelayedexpansion
set file=
set /p file= 请输入要操作的文件名称(包括扩展名):
set "file=%file:"=%"
for %%i in ("%file%&quo ...
@echo off
set file=
set /p file= 请把要处理的文件拉到本窗口:
set "file=%file:"=%"
for %%i in ("%file%") do set file=%%~fi
echo.
set replaced=
set /p replaced= 请输入即将被替换的内容:
echo.
set all=
set /p all= 请输入替换字符串:
cd.>"%file%_tmp.txt"
setlocal enabledelayedexpansion
for /f "tokens=1* delims=:" %%i in ('findstr /n .* "%file%"') do (
set str=%%j
if not "!str!"=="" set "str=!str:%replaced%=%all%!"
>>"%file%_tmp.txt" echo.!str!
)
copy "%file%" "%file%_bak.txt" >nul 2>nul
move "%file%_tmp.txt" "%file%"
start "" "%file%"