Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- set blank= >>nul
- :Reboot
- title DEC ^& HEX Converter
- :ChoiceField1
- cls
- echo Choice: [Use W and S to move and X to select, Q to leave]
- echo ^<-- Convert from HEX to DEC --^>
- echo -- Convert from DEC to HEX --
- echo.
- choice /n /c:wsxq
- if errorlevel 1 if not errorlevel 2 goto ChoiceField2
- if errorlevel 2 if not errorlevel 3 goto ChoiceField2
- if errorlevel 3 if not errorlevel 4 goto ConvHEXToDEC
- if errorlevel 4 if not errorlevel 5 Exit
- :ChoiceField2
- cls
- echo Choice: [Use W and S to move and X to select, Q to leave]
- echo -- Convert from HEX to DEC --
- echo ^<-- Convert from DEC to HEX --^>
- echo.
- choice /n /c:wsxq
- if errorlevel 1 if not errorlevel 2 goto ChoiceField1
- if errorlevel 2 if not errorlevel 3 goto ChoiceField1
- if errorlevel 3 if not errorlevel 4 goto ConvDECToHEX
- if errorlevel 4 if not errorlevel 5 Exit
- :ConvHEXToDEC
- title Convert from HEX to DEC
- cls
- echo Enter the HEX to convert to DEC
- echo.
- set /p HEX=HEX:%blank%
- if "%HEX%"=="" goto ConvHEXToDEC
- set /a DEC=0x%HEX%
- call cmd /c exit /b %DEC%
- set HEX=%=exitcode%
- SET HEXa=!HEX:~-2!
- SET HEXb=!HEX:~-4,-2!
- SET HEXc=!HEX:~-6,-4!
- set HEXd=!HEX:~-8,-6!
- set xeh=!HEXa!!HEXb!HEXc!!HEXd!
- cls
- echo Your Input: %HEX% (HEX)
- echo Your Output: %DEC% (DEC)
- echo.
- pause>>nul
- goto Reboot
- :ConvDECToHEX
- title Convert from DEC to HEX
- cls
- echo Enter the DEC to Convert to HEX.
- echo.
- set /p DEC=DEC:%blank%
- if "%DEC%"=="" goto NoInput
- cls
- call cmd /c exit /b %DEC%
- set HEX=%=exitcode%
- cls
- echo Your Input: %DEC% (DEC)
- echo The Output: %HEX% (HEX)
- echo.
- pause>>nul
- goto Reboot
Advertisement
Add Comment
Please, Sign In to add comment