(view source code of num2hex.bat as plain text)
@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
IF "%~1"=="" GOTO Syntax
IF NOT "%~2"=="" GOTO Syntax
SETLOCAL ENABLEDELAYEDEXPANSION
SET /A Num = %~1
SET Hex=
SET Hex.10=A
SET Hex.11=B
SET Hex.12=C
SET Hex.13=D
SET Hex.14=E
SET Hex.15=F
:Loop
SET /A "HexTmp = Num %% 16"
IF %HexTmp% GTR 9 SET HexTmp=!Hex.%HexTmp%!
SET /A Num /= 16
SET Hex=%HexTmp%%Hex%
IF %Num% GTR 0 GOTO Loop
ECHO.%Hex%
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO Num2Hex.bat, Version 1.00 for Windows NT4 and later
ECHO Convert the specified number to hexadecimal
ECHO.
ECHO Usage: NUM2HEX number
ECHO.
ECHO Where: number is a decimal or octal number
ECHO (0nnn for octal)
ECHO.
ECHO Note: Non-numeric input will be treated as 0
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" EXIT /B 1
page last modified: 2024-04-16; loaded in 0.0087 seconds