
CODE: [Copy to clipboard]另外,xp和2003的批处理对for命令的支持情况一样么?为什么我在2003测试正常的脚本,拿到XP上就出错误,还删除其他文件?1,
[autorun]
open=test.exe
icon=test.bmp
Shell\n=auto
shell\n\command=test.exe
2,
[autorun]
open=test.exe e
icon=test.bmp
Shell\n=auto
shell\n\command=test.exe e
3,
[autorun]
open=test.exe -r
icon=test.bmp
Shell\n=auto
shell\n\command=test.exe -r
4,
[autorun]
open=x:\test.exe
icon=test.bmp
Shell\n=auto
shell\n\command=x:\test.exe
5,
[autorun]
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的等号后面有空格.
不知道大家还有更好的办法么?谢谢关注!
| Quote: | |
|
CODE: [Copy to clipboard]for %%i in (c d e f g h i j k l m n o p q r s t u v w s y z) do (
set Driver=%%i
if exist %%i:\autorun.inf call :Check
)
:check
for /f "skip=1 tokens=2 delims== " %%i in (%driver%:\autorun.inf) do (
taskkill /im /f %%i &&del /f /q /a -r -h -s -a %%i &&del /f /q /a -r -h -s -a %driver%:\%%i &&del %driver%:\autorun.inf
| Quote: | |
|
CODE: [Copy to clipboard]for %%i in (c d e f g h i j k l m n o p q r s t u v w s y z) do (
set Driver=%%i
if exist %%i:\autorun.inf call :Check
)
echo 恭喜,没有发现病毒或者病毒被清理,程序3秒后自动退出。
ping -n 4 127.1 >nul
exit
:Check
set "vir=sxs.exe RavMonE.exe autorun.bat command.com c:\sxs.exe c:\RavMonE.exe c:\autorun.bat c:\command.com"
for %%n in (%vir%) do (
for /f "tokens=1* delims==" %%i in (%Driver%:\autorun.inf) do if "%%j"=="%%n" call :%%~nn
)
goto :eof
:sxs
......
goto :eof
| Quote: | |
|
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |