batch file to search all drives

Unknown DELL
January 6, 2009 at 10:14:36
Specs: Windows XP, sp2, 2.8 ghz intel, 500mb
I want to create a batch file that needs to scan all my drives for "autorun.inf" remove all attributes then del these files because of a virus. here is what I have so far and it isn't refined.
@echo off
rem "code needed for fixed drive search. probably some kind of a nested loop to include below code when each fixed drive is found."
IF EXIST autorun.inf attrib -s -h -r autorun.inf /d
DEL autorun.inf
"repeat until all drives searched"

any help to complete would be greatly appreciated.

See More: batch file to search all drives

Report •

January 6, 2009 at 22:24:09
search all available drives include floppy & cdrom. sorry, no checking against those drive.

@echo off & setlocal enabledelayedexpansion

for /f "tokens=1,2 delims=\ " %%a in ('fsutil fsinfo drives^|more/e/t0') do (
if "%%b"=="" (set drive=%%a) else set drive=%%b
echo scanning !drive!
for /f "tokens=*" %%f in ('dir !drive!\autorun.inf /b /s 2^>nul') do attrib -a -s -h "%%f" & del "%%f" & echo %%f

Report •
Related Solutions

Ask Question