RosettaCodeData/Task/Count-in-octal/Batch-File/count-in-octal.bat
2017-09-25 22:28:19 +02:00

25 lines
465 B
Batchfile

@echo off
:: {CTRL + C} to exit the batch file
:: Send incrementing decimal values to the :to_Oct function
set loop=0
:loop1
call:to_Oct %loop%
set /a loop+=1
goto loop1
:: Convert the decimal values parsed [%1] to octal and output them on a new line
:to_Oct
set todivide=%1
set "fulloct="
:loop2
set tomod=%todivide%
set /a appendmod=%tomod% %% 8
set fulloct=%appendmod%%fulloct%
if %todivide% lss 8 (
echo %fulloct%
exit /b
)
set /a todivide/=8
goto loop2