BatchHacker

[Batch Tool] DEC & HEX Converter

Nov 7th, 2013
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. set blank= >>nul
  3. :Reboot
  4. title DEC ^& HEX Converter
  5. :ChoiceField1
  6. cls
  7. echo Choice: [Use W and S to move and X to select, Q to leave]
  8. echo ^<-- Convert from HEX to DEC --^>
  9. echo  -- Convert from DEC to HEX --
  10. echo.
  11. choice /n /c:wsxq
  12. if errorlevel 1 if not errorlevel 2 goto ChoiceField2
  13. if errorlevel 2 if not errorlevel 3 goto ChoiceField2
  14. if errorlevel 3 if not errorlevel 4 goto ConvHEXToDEC
  15. if errorlevel 4 if not errorlevel 5 Exit
  16. :ChoiceField2
  17. cls
  18. echo Choice: [Use W and S to move and X to select, Q to leave]
  19. echo  -- Convert from HEX to DEC --
  20. echo ^<-- Convert from DEC to HEX --^>
  21. echo.
  22. choice /n /c:wsxq
  23. if errorlevel 1 if not errorlevel 2 goto ChoiceField1
  24. if errorlevel 2 if not errorlevel 3 goto ChoiceField1
  25. if errorlevel 3 if not errorlevel 4 goto ConvDECToHEX
  26. if errorlevel 4 if not errorlevel 5 Exit
  27. :ConvHEXToDEC
  28. title Convert from HEX to DEC
  29. cls
  30. echo Enter the HEX to convert to DEC
  31. echo.
  32. set /p HEX=HEX:%blank%
  33. if "%HEX%"=="" goto ConvHEXToDEC
  34. set /a DEC=0x%HEX%
  35. call cmd /c exit /b %DEC%
  36. set HEX=%=exitcode%
  37. SET HEXa=!HEX:~-2!
  38. SET HEXb=!HEX:~-4,-2!
  39. SET HEXc=!HEX:~-6,-4!
  40. set  HEXd=!HEX:~-8,-6!
  41. set xeh=!HEXa!!HEXb!HEXc!!HEXd!
  42. cls
  43. echo Your Input: %HEX% (HEX)
  44. echo Your  Output: %DEC% (DEC)
  45. echo.
  46. pause>>nul
  47. goto Reboot
  48. :ConvDECToHEX
  49. title Convert from DEC to HEX
  50. cls
  51. echo Enter the DEC to Convert to HEX.
  52. echo.
  53. set /p DEC=DEC:%blank%
  54. if "%DEC%"=="" goto NoInput
  55. cls
  56. call cmd /c exit /b %DEC%
  57. set HEX=%=exitcode%
  58. cls
  59. echo Your Input: %DEC% (DEC)
  60. echo The  Output: %HEX% (HEX)
  61. echo.
  62. pause>>nul
  63. goto Reboot
Advertisement
Add Comment
Please, Sign In to add comment