(view source code of videorom.bat as plain text)
@ECHO OFF
:: For Windows NT 4/2000/XP only
IF NOT [%OS%]==[Windows_NT] GOTO Syntax
:: No command line parameters required, "/2nd" is for internal use only
IF NOT [%1]==[] IF NOT [%1]==[/2nd] GOTO Syntax
:: OK, let's go
SETLOCAL
IF [%1]==[/2nd] (
:: DEBUG commands, to be piped to DEBUG.EXE
FOR %%A IN ("d C000:0040" "d C000:00C0" "q") DO ECHO.%%~A
) ELSE (
SET Info=
:: Recursive call is needed to enable piping screen output to DEBUG.EXE
FOR /F "tokens=16* delims= " %%A IN ('^(CMD.EXE /C "%~f0" /2nd 2^>NUL^) ^| DEBUG.EXE ^| FIND "C000:"') DO CALL :Parse "%%B"
)
:: Remove multiple dots
CALL :StripDots
:: Tidy up resulting string
CALL :Tidy
:: Show result
ECHO.
ECHO Video adapter ROM manufacturer info:
ECHO.
ECHO.%Info%
:: Done
ENDLOCAL
GOTO:EOF
:AddStr
:: Remove quotes and append to existing string
SET Info=%Info%%~1
GOTO:EOF
:Parse
:: Remove "unprintable" characters
SET Line=%1
SET Line=%!!|%
SET Line=%Line:<=%
SET Line=%Line:>=%
:: Remove quotes and append to existing string
CALL :AddStr %Line%
GOTO:EOF
:Reverse
:: Subroutine that reverses the specified input string
:: Initialize variables
SET Reverse=
SET Input=%*
:: Strip leading space in NT 4 only
VER | FIND "Windows NT" >NUL
IF NOT ERRORLEVEL 1 SET Input=%Input:~1%
:Loop
:: Continue till the input string's last character
IF NOT DEFINED Input GOTO:EOF
:: Separate first character from input string
SET FirstChar=%Input:~0,1%
SET Input=%Input:~1%
:: Rebuild string in reverse order
SET Reverse=%FirstChar%%Reverse%
:: Next character
GOTO Loop
:StripDots
:: Quit when no multiple dots are left
ECHO.%Info% | FIND ".." >NUL
IF ERRORLEVEL 1 GOTO:EOF
:: Remove multiple dots
SET Info=%Info:..=.%
:: Repeat
GOTO :StripDots
:Tidy
:: Split string at first space
FOR /F "tokens=1* delims= " %%A IN ('ECHO.%Info%') DO (
SET Prefix=%%A
SET TempInfo=%%B
)
:: Quit if string wasn't split
IF NOT DEFINED TempInfo GOTO:EOF
:: Split at next space if first space was followed by a dot
IF "%TempInfo:~0,1%"=="." FOR /F "tokens=1* delims= " %%A IN ('ECHO.%TempInfo%') DO (
SET Prefix=%Prefix% %%A
SET TempInfo=%%B
)
:: Quit if string wasn't split
IF NOT DEFINED TempInfo GOTO:EOF
:: Split at next space if previous space was followed by a dot
IF "%TempInfo:~0,1%"=="." FOR /F "tokens=1* delims= " %%A IN ('ECHO.%TempInfo%') DO (
SET Prefix=%Prefix% %%A
SET TempInfo=%%B
)
:: Quit if string wasn't split
IF NOT DEFINED TempInfo GOTO:EOF
:: Reverse first part of string
CALL :Reverse %Prefix%
:: Quit if last character of first string part was a dot
IF "%Reverse:~0,1%"=="." GOTO:EOF
:: Remove everything after first dot, efectively keeping
:: only the reversed last "word" of first part of string
FOR /F "tokens=1 delims=." %%a IN ('ECHO.%Reverse%') DO SET Prefix=%%a
:: Reverse again
CALL :Reverse %Prefix%
:: Concatenate the 2 parts
SET Info=%Reverse% %TempInfo%
GOTO:EOF
:Syntax
ECHO.
ECHO VideoROM.cmd, Version 4.00 for Windows NT 4 / 2000 / XP
ECHO Reads and displays manufacturer information from your video adapter ROM
ECHO.
ECHO Usage: %~n0
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO Original idea by ComputerHope
ECHO http://www.computerhope.com/rdebug.htm
page last modified: 2024-04-16; loaded in 0.0062 seconds