Código:
::DETECTOR OF REMOVABLE DEVICES [V5.0c Final] author CarlitoS.dll
::carlitosdll.blogspot.com
::Tested in Windows 2000 and XP. Not works in Windows 98 and Me.
@echo off
if "%errorlevel%"=="" goto other
echo Mounted removable devices detected
echo ----------------------------------
ver | findstr "2000 NT" >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:)
pause
goto :eof
:NT2000
regedit /e "%temp%\devices.dat" "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices"
for /f "tokens=3 delims=\:" %%a in ('find /i "DosDevices" ^< "%temp%\devices.dat" ^| find /i "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
pause
goto :eof
:other
echo Current batch is not supported in this Operating System version.
exit