CODE: [Copy to clipboard]
::cody by lxmxn @ cn-dos.net
::Date 20:11 2006-12-29
@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 length:■%a%■
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
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;&echo;Press any key to exit.&pause>nul&goto :eof