Código:
@ECHO OFF
:: RDAP.CMD
:: REMOVABLE DRIVE AUTORUN PROTECTOR Version 12:44 14-03-2009
::
:: ONLY FOR RUN UNDER WINDOWS XP AND REMOVABLE DRIVE WITH FAT OR FAT32 FILESYSTEM.
::
:: AUTHOR: 0X0309
::
TITLE REMOVABLE DRIVE AUTORUN PROTECTOR
SETLOCAL ENABLEEXTENSIONS
VER | FIND /i " XP" >NUL
IF ERRORLEVEL -1 IF ERRORLEVEL 1 (
ECHO. SCRIPT ONLY FOR WINDOWS XP.
GOTO END
)
ECHO\Detecting removable drives . . .
SET "TXT=530054004F00520041"
FOR /F "DELIMS=\: TOKENS=0X3" %%^^ IN ('REG QUERY HKLM\SYSTEM\MOUNTEDDEVICES ^| FIND "%TXT%"') DO (
VOL %%^^: 8>NUL 1>&8 2>&1 && (
ECHO\Found removable drive %%^^:
CHKDSK %%^^: 0>NUL 2>&0 | FIND " FAT" >NUL
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 (
IF EXIST %%^^:\AUTORUN.INF (DEL /F /Q /A %%^^:\AUTORUN.INF 7>NUL 1>&7 2>&1)
IF EXIST %%^^:\AUTORUN.INF (RD /Q /S \\?\%%^^:\AUTORUN.INF 6>NUL 1>&6 2>&1)
(MD \\?\%%^^:\AUTORUN.INF\...\) 5>NUL 1>&5 2>&1
(RD /Q /S \\?\%%^^:\AUTORUN.INF\...) 4>NUL 1>&4 2>&1
(CD.>\\?\%%^^:\AUTORUN.INF\NUL) 3>NUL 1>&3 2>&1
(MD \\?\%%^^:\AUTORUN.INF\...\%RANDOM%\...\ 9>NUL 1>&9 2>&1)
IF EXIST %%^^:\AUTORUN.INF (ECHO\The removable drive %%^^: was protected.)
) ELSE (ECHO. %%^^: IS NOT WITH FILESYSTEM FAT OR FAT32.)
)
)
:END
(0>NUL SET /P %%=Press a key to quit . . . )
PAUSE >NUL
GOTO :EOF