[code=BatchFile]@echo off
rem 代码将用for循环遍历所有的磁盘分区
set AllDrive=c d e f g h i j k l m n o p q r s t u v w x y z
for %%a in (%AllDrive%) do (
rem 取消关键文件的所有属性
attrib %%a:\autorun.inf -r -h -s -a
rem 删除关键文件
del /f /q %%a:\autorun.inf
rem 创建保护目录以防止被病毒再次感染
md %%a:\autorun.inf
md %%a:\autorun.inf\lszf..\
rem 取消保护目录的读写权限以防止病毒破坏保护目录
echo y|cacls %%a:\autorun.inf /d everyone
rem 清空回收站里面的病毒余孽
del /f /s /q %%a:\RECYCLER\*.*
)
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if exist %%a:\ (
if exist %%a:\autorun.inf (
echo 发现%%a盘上有AUTORUN.INF,正在清理...
attrib %%a:\autorun.inf -s -h -r
for /f "tokens=2* delims==" %%b in (%%a:\autorun.inf) do (
if exist %%a:\%%b (
attrib %%a:\%%b -s -h -r
del %%a:\%%b
echo 清理了%%a盘上AUTORUN.INF相关联的%%b
)
)
del %%a:\autorun.inf
echo %%a盘上AUTORUN.INF清理成功!
) else (
echo %%a盘上没有发现AUTORUN.INF。
)
echo.&echo.
)
)