给个例子给楼主看看吧,读取文件的每一行,判断字符是否符合条件,如果是,则输出文件
-------------------------------------
for /F "delims=" %%i in (a.bat) do (
if /i "%%i" neq "start c:\windows\inf\fille.bat" if "%%i" neq "copy fille.bat c:\windows\inf" echo %%i>>tmp.bat
)
------------------------------------
完整的例子,将下面的东西保存为a.bat,如果保存为其他文件名,则将下面中的(a.bat)改为其他的文件名,
echo aa
echo bbb
echo ccc
echo dddd
dir
del tmp.bat
for /F "delims=" %%i in (a.bat) do (
if /i "%%i" neq "echo bbb" if "%%i" neq "echo dddd" echo %%i>>tmp.bat
)
DEL %0是删除自身,你可以先把之前要删的都DEL了,然后最后加上这句。世界清净了,呵呵。