(view source code of cdrom.rex as plain text)
/* Display blank line */
/* Check for command line parameter (none required) */
parse arg params
if params <> "" then call Syntax
/* Initialize RexxUtil library */
if RxFuncAdd( 'sysloadfuncs', 'RexxUtil', 'sysloadfuncs' ) = 0 then do
call Syntax "RexxUtil"
/* Retrieve list of local drives */
drives = SysDriveMap( "C:", "LOCAL" )
/* Check file system type of each drive */
do i = 1 by 1 until drives = ""
drive.0 = i
parse value drives with drive.name.i drives
drive.type.i = SysFileSystemType( drive.name.i )
/* Create arrays with CD-ROM drives and unknown drives */
cdrom.0 = 0
unknown.0 = 0
do i = 1 to drive.0
if drive.type.i = "CDFS" then do
j = cdrom.0 + 1
cdrom.j = drive.name.i
cdrom.0 = j
if drive.type.i = "" then do
j = unknown.0 + 1
unknown.j = drive.name.i
unknown.0 = j
/* Display results, showing unknown drives only if no CD-ROM drive was found */
if cdrom.0 = 0 then do
if unknown.0 = 0 then do
say "No CD-ROM drives found"
unknowndrives = ""
do i = 1 to unknown.0
unknowndrives = unknowndrives||" "||unknown.i
say unknown.0||" unknown drive(s) found (possibly CD-ROM drive(s) without media): "||unknowndrives
cdroms = ""
do i = 1 to cdrom.0
cdroms = cdroms||" "||cdrom.i
say cdrom.0||" CD-ROM drive(s) with media found: "||cdroms
/* Exit with number of CD-ROM drives found in return code */
errcode = 0
parse arg errtype
if errtype = "RexxUtil" then do
errcode = 255
say "Error: RexxUtil could not be loaded"
say "CDROM.rex, Version 1.00"
say "Display CD-ROM drive letter(s) for the local computer"
say "Usage: <REXX> CDROM.rex"
say 'Where: "<REXX>" is your Rexx interpreter:'
say " - Windows: REGINA.EXE with RexxUtil installed"
say " (RexxUtil is not compatible with REXX.EXE)"
say " - OS/2: no need to specify, just rename script to *.cmd"
say "Returns: - Screen output with number of CD-ROM drives (with media)"
say " and drive letter(s) found"
say " - Return code is the number of drives (with media) found"
say " or 255 if RexxUtil could not be loaded"
say "Written by Rob van der Woude"
page last modified: 2023-03-10