(view source code of cdplayer.bat as plain text)
@ECHO OFF
:: For Windows NT only
VER | FIND "Windows NT" >NUL
IF ERRORLEVEL 1 GOTO Syntax
:: Use local environment
SETLOCAL
:: Check command line parameter
ECHO.%* | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
:: Find all registry sub-keys of HKEY_LOCAL_MACHINE\SYSTEM\DISK
REGEDIT /E %TEMP%.\CDROM1.REG "HKEY_LOCAL_MACHINE\SYSTEM\DISK"
:: Find the CD-ROM drive
FOR /F "tokens=2 delims==" %%A IN ('TYPE %TEMP%.\CDROM1.REG ^| FIND /I "\\Device\\CdRom"') DO SET CDAudio=%%A
SET CDAudio=%CDAudio:"=%
:: Delete the temporary .REG file
DEL %TEMP%.\CDROM1.REG
:: Select the track
SET Track=%1
IF %Track%0 LSS 100 (SET Track=0%Track%) ELSE (SET Track=%Track%)
IF EXIST "%CDAudio%\Track%Track%.cda" (
SET Play="%CDAudio%\Track%Track%.cda"
) ELSE (
ECHO.
ECHO Track%Track% not found on CD in drive %CDAudio%
ECHO Playing all tracks instead
SET Play="%CDAudio%"
)
:: Start the player
START "CD Audio" CDPLAYER.EXE -play %Play%
:: Done
ENDLOCAL
GOTO End
:Syntax
ECHO.
ECHO CDPlayer.bat, Version 1.00 for Windows NT 4
ECHO Play audio CD or track(s)
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
ECHO Usage: CDPLAYER [ track_number ]
:End
page last modified: 2024-04-16; loaded in 0.0086 seconds