📄 hex2dec.bat
字号:
::cody by lxmxn @ cn-dos.net
::十六进制转到十进制
::Date 16:23 2007-1-12
@echo off&Setlocal EnableDelayedExpansion
:redo
set /p str=Please input a hex string:
if "%str%"=="" echo Invalid input,please input again.&pause&goto redo
cls&set a=0
:begin
if not "!str:~%a%,1!"=="" set /a a+=1&&goto begin
echo The string you inputed is →%str%←,it's length:→%a%←
if "%1"=="/z" goto zhuanhuan
echo;
set/p=The final result is:→<nul
for /l %%a in (0,2,%a%) do (
Setlocal EnableDelayedExpansion
if not "!str:~%%a,1!"=="" (
set /p result=%%!str:~%%a,2!<nul
)
Endlocal
)
echo ←
echo;
set /p choose=Change it to Hexadecimal? Please Enter Y or N to choose:^>
if /i not "%choose%"=="y" goto :eof
echo %str%|findstr "^[0-9a-fA-F]*$" >nul
if errorlevel 1 echo;&echo;The string isn't a hexadecimal number.Any key to Exit.&pause>nul&goto :eof
:zhuanhuan
echo;
(for /l %%a in (0,2,%a%) do (
Setlocal EnableDelayedExpansion
if not "!str:~%%a,1!"=="" (
set /a b=0x!str:~%%a,2!
set /p b= !b!<nul
)
Endlocal
))&echo;&echo;&set/p=Press any key to exit.<nul&pause>nul&goto :eof
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -