want command lines .bat to search in all files in c:\ and if exist virus.bat
Del virus.bat
set /a viruses=%viruses%+1
cls
echo Yoy are infected! The infected files ware deleted !!
pause
goto Start
ELSE
cls
echo Your computer is clean!
pause
goto Start
i look in many web sites and got nothing ! :(
del /?
could help. Then, use
del /F /S c:\virus.bat &echo Your computer is clean!
pause
goto Start
Output examples (another drive):
==>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!
==>
(In respond to your comment). The effect is the same: your computer could be clean as soon as infected files were deleted... :) However, if you do insist on exact wording, start with
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
)
Resources (required reading):
%~G
etc. special page) Command Line arguments (Parameters)