12-10-2022, 06:58 AM
A QBasic way...
The "not ready" is going to be the optical drive if it does not contain media. Error 68 is drive not ready.
We can't use CHDIR as it will not differentiate a drive not ready, therefore it would not show the optical drive at all.
~.~ simply denotes a file name no one should have. It triggers the error 53, file not found, which we ignore. Error 76 is drive not found.
Pete
Code: (Select All)
ON ERROR GOTO er1
FOR i = 1 TO 26
drive$ = CHR$(i + 64)
OPEN drive$ + ":\~.~" FOR INPUT AS #1: CLOSE #1
IF found THEN
IF found = 1 THEN PRINT drive$ ELSE PRINT drive$ + " not ready."
END IF
NEXT
END
er1:
er% = ERR
SELECT CASE er%
CASE 76
' Not found so do nothing.
found = 0
CASE 53
found = 1
CASE 68
found = 2
END SELECT
RESUME NEXT
The "not ready" is going to be the optical drive if it does not contain media. Error 68 is drive not ready.
We can't use CHDIR as it will not differentiate a drive not ready, therefore it would not show the optical drive at all.
~.~ simply denotes a file name no one should have. It triggers the error 53, file not found, which we ignore. Error 76 is drive not found.
Pete
If eggs are brain food, Biden takes his scrambled.