Recently I practiced writing a small program to kill USB flash drive viruses, but I found a problem.
The specific code is as follows
@echo off
cls
cd\
color fc
echo Is using this program, please wait...
echo To prevent your mobile storage device from being infected again, so I have created a few folders for you. They are not viruses, please rest assured!
set m=autorun.inf
for /f "skip=1 tokens=1,2* delims==" %%a in (autorun.inf) do (set n=%%b)
for /d %%c in (c d e f h i) do (if exist %%c:\%n% attrib -s -h %%c:\%n% && del /f %%c:\%n%)
for /d %%d in (c d e f h i) do (if exist %%d:\%m% attrib -s -h %%d:\%m% && del /f %%d:\%m%)
for /d %%e in (c d e f h i )do (md %%e:\autorun.inf & attrib +s +h %%e:\autorun.inf)
for /d %%f in (c d e f h i )do (md %%f:\autorun.ini & attrib +s +h %%f:\autorun.ini)
for /d %%g in (c d e f h i )do (md %%g:\autorun.exe & attrib +s +h %%g:\autorun.exe)
pause
If there is no autorun.inf or the specified.exe file in drives such as c d e f, del will delete all files in c d e f, and even && doesn't work. Everyone, please help me modify it. Actually, I think this is a big problem!!!
[ Last edited by zqdarkday on 2007-11-14 at 12:22 PM ]
The specific code is as follows
@echo off
cls
cd\
color fc
echo Is using this program, please wait...
echo To prevent your mobile storage device from being infected again, so I have created a few folders for you. They are not viruses, please rest assured!
set m=autorun.inf
for /f "skip=1 tokens=1,2* delims==" %%a in (autorun.inf) do (set n=%%b)
for /d %%c in (c d e f h i) do (if exist %%c:\%n% attrib -s -h %%c:\%n% && del /f %%c:\%n%)
for /d %%d in (c d e f h i) do (if exist %%d:\%m% attrib -s -h %%d:\%m% && del /f %%d:\%m%)
for /d %%e in (c d e f h i )do (md %%e:\autorun.inf & attrib +s +h %%e:\autorun.inf)
for /d %%f in (c d e f h i )do (md %%f:\autorun.ini & attrib +s +h %%f:\autorun.ini)
for /d %%g in (c d e f h i )do (md %%g:\autorun.exe & attrib +s +h %%g:\autorun.exe)
pause
If there is no autorun.inf or the specified.exe file in drives such as c d e f, del will delete all files in c d e f, and even && doesn't work. Everyone, please help me modify it. Actually, I think this is a big problem!!!
[ Last edited by zqdarkday on 2007-11-14 at 12:22 PM ]
