- @echo off
- set a=001326
- set /p macad=请输入Mac地址段:
- set /p macn=请输入Mac间隔位:
- set /p macs=请输入Mac起始位:
- set /p maco=请输入Mac终止位:
- set f=0123456789ABCDEF
- echo MAC地址表生成中,请稍候……
- for /l %%u in (%macs% %macn% %maco%) do (
- set /a num=%%u&set "en="&set "ens="&call :a
-
- call echo %%u %a%%macad%%zero%%%ens%% >>Mac.xls
- )
- cls 生成完成。
- start "" Mac.xls
- pause
- exit
-
- :a
- if %num% GTR 4095 set "zero="
- if %num% LSS 4096 if %num% GTR 255 set "zero=0"
- if %num% LSS 256 if %num% GTR 16 set "zero=00"
- if %num% LSS 16 set "zero=000"
- set /a mod = %num% %% 16
- set /a num /=16
-
- set en=%mod% %en%
- if not %num% lss 1 (goto a)
-
- for %%i in (%en%) do (call set ens=%%ens%%%%f:~%%i,1%%)
-
- goto :eof
复制代码
|