首先感谢zh159,namejm,ccwan的指点.
最近一直想写一个autorun.inf病毒的通杀程序.有些问题不好解决,放到这里请大家多多出出主意.
autorun.inf的内容一般为以下几种形式:
1,
open=test.exe
icon=test.bmp
Shell\n=auto
shell\n\command=test.exe
2,
open=test.exe e
icon=test.bmp
Shell\n=auto
shell\n\command=test.exe e
3,
open=test.exe -r
icon=test.bmp
Shell\n=auto
shell\n\command=test.exe -r
4,
open=x:\test.exe
icon=test.bmp
Shell\n=auto
shell\n\command=x:\test.exe
5,
open=x:\test.exe e
icon=test.bmp
Shell\n=auto
shell\n\command=x:\test.exe e
我写的截取命令如下:
for /f "skip=1 tokens=2 delims== " %%i in (%driver%:\autorun.inf) do (
echo %%i >>temp.txt)delims的等号后面有空格.
不知道大家还有更好的办法么?谢谢关注!
另外,xp和2003的批处理对for命令的支持情况一样么?为什么我在2003测试正常的脚本,拿到XP上就出错误,还删除其他文件?
在for do()中,括号中的多条命令是否必须用 &&连接?我看到zh159大侠都是换行!