(view source code of num2bin.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 Bin=
:Loop
SET /A "BinTmp = Num %% 2"
SET /A Num /= 2
SET Bin=%BinTmp%%Bin%
IF %Num% GTR 0 GOTO Loop
ECHO.%Bin%
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO Num2Bin.bat, Version 1.00 for Windows NT4 and later
ECHO Convert the specified number to binary
ECHO.
ECHO Usage: NUM2BIN number
ECHO.
ECHO Where: number is a decimal, hexadecimal or octal number
ECHO (0xnnn for hexadecimal, 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.0072 seconds