Powered by GeSHi

Source code for getflashdrivesxp.bat

(view source code of getflashdrivesxp.bat as plain text)

  1. @ECHO OFF
  2. :: Check Windows version and command line arguments (none required)
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4. IF NOT  "%~1"==""           GOTO Syntax
  5.  
  6. :: Read the list of physical drives from the registry, and show only the CDROM drives
  7. FOR /F "tokens=2 delims=\ " %%A IN ('REG Query "HKLM\SYSTEM\MountedDevices" /s ^| FIND "\DosDevices\" ^| FINDSTR /R /E /C:" 5F[0-9A-F]*"') DO ECHO.%%A
  8. GOTO:EOF
  9.  
  10. :Syntax
  11. ECHO.
  12. ECHO GetFlashDrivesXP.bat,  Version 1.00 for Windows XP and later
  13. ECHO List all removable ("Flash") drives on the local computer
  14. ECHO.
  15. ECHO Usage:   GETFLASHDRIVESXP
  16. ECHO.
  17. ECHO Written by Rob van der Woude
  18. ECHO http://www.robvanderwoude.com
  19.