希望命令行 .bat 搜索 c:\ 中的所有文件,如果存在 virus.bat 则删除并执行一些代码 ELSE 执行另一个
want command lines .bat to search in all files in c:\ and if exist virus.bat deleted and do some code ELSE do another
想要命令行 .bat 搜索 c:\ 中的所有文件,如果存在 virus.bat
Del virus.bat
set /a viruses=%viruses%+1
cls
echo Yoy are infected! The infected files ware deleted !!
pause
goto Start
其他
cls
echo Your computer is clean!
pause
goto Start
我浏览了很多网站,但一无所获! :(
del /?
可以提供帮助。然后,使用
del /F /S c:\virus.bat &echo Your computer is clean!
pause
goto Start
输出示例(另一个驱动器):
==>del /F /S d:\virus.bat &echo Your computer is clean!
Deleted file - d:\bat\virus.bat
Deleted file - d:\temp\virus.bat
Your computer is clean!
==>del /F /S d:\virus.bat &echo Your computer is clean!
Could Not Find d:\virus.bat
Your computer is clean!
==>
(回应您的评论)。效果是一样的:只要删除了受感染的文件,您的计算机就可以干净了...:) 但是,如果您坚持使用准确的措辞,请从
开始
set "virusfound="
for /F "delims=" %%G in ('dir /B /S "c:\virus.bat"') do (
set "virusfound=%%G"
del /F "%%~G"
)
if defined virusfound (
echo virus found, did an attempt to delete it
) else (
echo virus not found
)
资源(必读):
想要命令行 .bat 搜索 c:\ 中的所有文件,如果存在 virus.bat
Del virus.bat
set /a viruses=%viruses%+1
cls
echo Yoy are infected! The infected files ware deleted !!
pause
goto Start
其他
cls
echo Your computer is clean!
pause
goto Start
我浏览了很多网站,但一无所获! :(
del /?
可以提供帮助。然后,使用
del /F /S c:\virus.bat &echo Your computer is clean!
pause
goto Start
输出示例(另一个驱动器):
==>del /F /S d:\virus.bat &echo Your computer is clean!
Deleted file - d:\bat\virus.bat
Deleted file - d:\temp\virus.bat
Your computer is clean!
==>del /F /S d:\virus.bat &echo Your computer is clean!
Could Not Find d:\virus.bat
Your computer is clean!
==>
(回应您的评论)。效果是一样的:只要删除了受感染的文件,您的计算机就可以干净了...:) 但是,如果您坚持使用准确的措辞,请从
开始set "virusfound="
for /F "delims=" %%G in ('dir /B /S "c:\virus.bat"') do (
set "virusfound=%%G"
del /F "%%~G"
)
if defined virusfound (
echo virus found, did an attempt to delete it
) else (
echo virus not found
)
资源(必读):