(view source code of removables.bat as plain text)
:: DETECTOR OF REMOVABLE DEVICES [V5.0c Final] author Carlitos.dll
:: carlitosdll.blogspot.com
:: Tested in Windows 2000 and XP. Doesn't work in Windows 98 and ME.
@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Other
ECHO Mounted removable devices detected
ECHO.----------------------------------
VER | FIND "NT" >NUL && GOTO NT2000
VER | FIND "2000" >NUL && GOTO NT2000
:XPVISTASEVEN
FOR /F "tokens=3 delims=\:" %%A IN ('REG Query HKLM\SYSTEM\MountedDevices ^| FIND "530054004F00520041"') DO (
DIR /A %%A:\ >NUL 2>&1 && ECHO.%%A:
)
GOTO:EOF
:NT2000
START /WAIT REGEDIT /E "%Temp%\devices.dat" "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices"
FOR /F "tokens=3 delims=\:" %%A IN ('TYPE "%Temp%\devices.dat" ^| FINDSTR /R /B /I /C:"\"\\\\DosDevices\\\\[A-Z]:\"=hex:.*,53,00,54,00,4f,00,52,00,41"') DO (
DIR /A %%A:\ >NUL 2>&1 && ECHO.%%A:
)
DEL /F /Q "%Temp%\devices.dat" >NUL 2>&1
GOTO:EOF
:Other
ECHO Current batch is not supported in this Operating System version.
page last modified: 2024-04-16; loaded in 0.0048 seconds