本帖最后由 a20150604 于 2020-8-14 18:01 编辑
纯批:- @echo off & setlocal enabledelayedexpansion
- set "MAC=F825A3BCF203"
-
- if 0x%MAC:~-6%==0xFFFFFF (
- set /a "h6=0x%MAC:~0,6% + 1"
- call :dec2hex h6 !h6!
- set "result=!h6:~-6!000000"
- ) else (
- set /a "l6=0x%MAC:~-6% + 1"
- call :dec2hex l6 !l6!
- set "result=%MAC:~0,6%!l6:~-6!"
- )
- set result
- pause
- exit
-
- :dec2hex hex dec
- setlocal
- set "dic=0123456789ABCDEF"
- for /L %%a in (0 1 7) do (
- set /a "t = ( %~2 >> (4*%%a) ) & 0xF"
- for %%p in (!t!) do set "hex_num=!dic:~%%p,1!!hex_num!"
- )
- endlocal & set "%1=%hex_num%
- exit /b
复制代码
|