作者:gugudeai | 时间:2009-02-04 21:12 | 标题:[已结]批处理实现指定字符替换TXT中的内容
要求要把指定字符写到全盘的(c:d:e:....)txt中.
而且不要重复写入.

希望牛人能给看看怎么做!
[
Last edited by HAT on 2009-2-7 at 11:36 ]
作者:HAT | 时间:2009-02-04 21:35
本版搜索“全盘”
作者:netbenton | 时间:2009-02-04 21:41
c:盘的搞定了,其它的,自己想办法吧
for /f "delims=" %%a in ('dir /s /b c:\*.txt') do echo.没必要的>>%%~fa
作者:gugudeai | 时间:2009-02-05 10:46
谢谢!我看看!
作者:gugudeai | 时间:2009-02-05 18:45
好像for /f "delims=" %%a in ('dir /s /b c:\*.txt') do echo.没必要的>>%%~fa
重复添加那句话!怎么让他添加过后不添加了?
而且怎么让他直接追加到文件头部而不是后面
作者:netbenton | 时间:2009-02-05 19:00 | 标题:再看看这样吧
::添加到前面的。
for /f "delims=" %%a in ('dir /s /b c:\*.txt') do echo.没必要的>%temp%\没必要.tmp&type %%~fa>>%temp%\没必要.tmp&type %temp%\没必要.tmp>%%~fa
::防止重复添加。
for /f "delims=" %%a in ('dir /s /b c:\*.txt') do call :sub "%%~fa"
goto :eof
:sub
set /p var=<"%1"
if '%var%=='没必要的 goto :eof
echo.没必要的>%temp%\没必要.tmp&type "%1">>%temp%\没必要.tmp&type %temp%\没必要.tmp>"%1"
[ Last edited by netbenton on 2009-2-5 at 19:10 ]
作者:zhengqian529 | 时间:2009-02-05 19:28
楼上正解
作者:gugudeai | 时间:2009-02-07 09:58
解决了!谢谢!