hexadecimal to decimal batch file

前端 未结 3 759
情话喂你
情话喂你 2021-01-14 22:07

okay so I have been working an a batch file that converts a base ten decimal value in to hexadecimal but I can\'t get the for loops and the if statements down right every we

3条回答
  •  忘掉有多难
    2021-01-14 22:44

    Phew - what a lot of Code. This is a little bit shorter:

    @echo off
    setlocal enabledelayedexpansion
    set "hex=0123456789ABCDEF"
    set /p INPUT=Enter a number (0-255):
    set /a high=%INPUT% / 16
    set /a low=%INPUT% %% 16
    echo in hexadecimal %INPUT% = !hex:~%high%,1! !hex:~%low%,1!
    

提交回复
热议问题