?? 10進制轉換為16進制.bat
字號:
@echo off
:: 10進制轉換為16進制
:: code by 3742668 2006-6-28 CMD@XP
set /p 源數=輸入十進制數字:
set /a 源數=%源數% || goto :eof
:dosomething
set /a 余數 = %源數% %% 16
set /a 源數 /= 16
call :轉換 %余數%
set 余數=%ret%
set 計算結果=%余數%%計算結果%
if %源數% lss 16 goto end
goto dosomething
:轉換
set ret=
if "%1" == "10" set ret=A
if "%1" == "11" set ret=B
if "%1" == "12" set ret=C
if "%1" == "13" set ret=D
if "%1" == "14" set ret=E
if "%1" == "15" set ret=F
if %1 lss 10 set ret=%1
goto :eof
:end
call :轉換 %源數%
set 源數=%ret%
if "%源數%" == "0" set 源數=
echo 0x%源數%%計算結果%
set ret=
set 源數=
set 余數=
set 計算結果=
pause>nul
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -