(view source code of cdrom.rex as plain text)
/* Display blank line */say/* 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 sysloadfuncsendelse do
call Syntax "RexxUtil"
end/* 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 = iparse value drives with drive.name.i drives
drive.type.i = SysFileSystemType( drive.name.i )
end/* 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 endif drive.type.i = "" then do
j = unknown.0 + 1
unknown.j = drive.name.i
unknown.0 = j endend/* 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"
endelse do
unknowndrives = ""
do i = 1 to unknown.0
unknowndrives = unknowndrives||" "||unknown.i
endsay unknown.0||" unknown drive(s) found (possibly CD-ROM drive(s) without media): "||unknowndrives
endendelse do
cdroms = ""
do i = 1 to cdrom.0
cdroms = cdroms||" "||cdrom.i
endsay cdrom.0||" CD-ROM drive(s) with media found: "||cdroms
end/* Exit with number of CD-ROM drives found in return code */EXIT cdrom.0Syntax:
errcode = 0
parse arg errtype
if errtype = "RexxUtil" then do
errcode = 255
say "Error: RexxUtil could not be loaded"
say endsay "CDROM.rex, Version 1.00"
say "Display CD-ROM drive letter(s) for the local computer"
saysay "Usage: <REXX> CDROM.rex"
saysay '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"
saysay "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"
saysay "Written by Rob van der Woude"
say "http://www.robvanderwoude.com"
EXIT errcodereturnpage last modified: 2025-10-11; loaded in 0.0074 seconds