(view source code of midititl.bat as plain text)
@ECHO OFF
:: Check Windows version
IF "%OS%"=="Windows_NT" (SETLOCAL) ELSE (GOTO Syntax)
VER | FIND "Windows NT" >NUL && GOTO Syntax
:: Check command line arguments
IF "%~1"=="" GOTO Syntax
IF NOT EXIST "%~1" GOTO Syntax
:: For NT4 without Resource Kit, replace FINDSTR.EXE /E /I by FIND /I
ECHO.%*| FINDSTR.EXE /E /I ".mid" >NUL 2>&1 || GOTO Syntax
:: Check if STRINGS.EXE is available and if not, offer to download it
SET StringsAvailable=
SET Download=
(STRINGS.EXE /? 2>NUL) | FIND "Mark Russinovich" >NUL
IF ERRORLEVEL 1 (
SET StringsAvailable=No
ECHO This batch file requires SysInternal's STRINGS untility.
SET /P Download=Do you want to download it now? [y/N]
)
:: Start download if requested
IF /I "%Download%"=="Y" (
START "Strings" "http://www.sysinternals.com/ntw2k/source/misc.shtml#strings"
ECHO.
ECHO Install the downloaded file and make sure STRINGS.EXE is in the PATH.
ECHO Then try again.
)
:: Abort if STRINGS.EXE is not available yet
IF "%StringsAvailable%"=="No" GOTO End
:: OK, finally, let's list the MIDI titles
FOR %%A IN (%*) DO (
CALL SET Title=
FOR /F "tokens=*" %%a IN ('STRINGS.EXE -A -N 5 "%%~A" ^| MORE /E ^+5') DO CALL :Parse "%%~a"
IF DEFINED Title (
ECHO.
CALL ECHO%%Title%%
)
)
:: Done
GOTO End
:Parse
SET Title=%Title% %~1
GOTO:EOF
:Syntax
ECHO.
ECHO MidiTitl.bat, Version 1.01 for Windows NT 4 [2] / 2000 / XP
ECHO Display the titles of the specified MIDI files
ECHO.
ECHO Usage: MIDITITL filespec.MID
ECHO.
ECHO Where: filespec is the (list of) MIDI file(s); wildcards are allowed,
ECHO but filespec.MID should always end with .MID
ECHO.
ECHO Notes: [1] This batch file requires SysInternals' STRINGS utility, available
ECHO at http://www.sysinternals.com/ntw2k/source/misc.shtml#strings
ECHO You will be prompted to download STRINGS if it isn't found.
ECHO [2] This batch file uses FINDSTR, which is a native command in Windows
ECHO 2000 and XP, but requires the Resource Kit for Windows NT 4.
ECHO Read the comments in this batch file for modifications required
ECHO for Windows NT 4 without Resource Kit.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
:End
IF "%OS%"=="Windows_NT" ENDLOCAL
page last modified: 2024-04-16; loaded in 0.0046 seconds