(view source code of num2oct.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 Oct=
:Loop
SET /A "OctTmp = Num %% 8"
SET /A Num /= 8
SET Oct=%OctTmp%%Oct%
IF %Num% GTR 0 GOTO Loop
ECHO.%Oct%
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO Num2Oct.bat, Version 1.01 for Windows NT4 and later
ECHO Convert the specified number to octal
ECHO.
ECHO Usage: NUM2OCT number
ECHO.
ECHO Where: number is a decimal or hexadecimal number
ECHO (0xnnn for hexadecimal)
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.0073 seconds