日期:2014-05-17 浏览次数:20872 次
::生成十六位随机码 - Forever_Young @echo off&setlocal enabledelayedexpansion set "hexstr=0123456789ABCDEF" set "ranhex=" for /l %%j in (1,1,8) do ( set /a "dec=!random!" set "hex=" for /l %%n in (1,1,2) do ( set /a "d=dec&15,dec>>=2" for %%d in (!d!) do set "hex=!hexstr:~%%d,1!!hex!" ) set ranhex=!hex!!ranhex! ) echo !ranhex! pause
------解决方案--------------------
@echo off & setlocal enabledelayedexpansion set s=0123456789ABCDEF set "result=" for /l %%a in (1,1,16) do ( set /a r=!random!%%16 call set result=!result!%%s:~!r!,1%% ) echo %result% pause