Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for getcdromdrivesxp.bat

(view source code of getcdromdrivesxp.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:" 5C[0-9A-F]*"') DO ECHO.%%A
  8. GOTO:EOF
  9.  
  10. :Syntax
  11. ECHO.
  12. ECHO GetCDROMDrivesXP.bat,  Version 1.10 for Windows XP and later
  13. ECHO List all CDROM drives on the local computer
  14. ECHO.
  15. ECHO Usage:   GETCDROMDRIVESXP
  16. ECHO.
  17. ECHO Written by Rob van der Woude
  18. ECHO http://www.robvanderwoude.com
  19.  

page last modified: 2024-04-16; loaded in 0.0089 seconds