首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > windows >

BAT批处理能否实现16位随机码,该如何处理

2012-01-24 
BAT批处理能否实现16位随机码在批处理文件中能不能生成16位的随机码,如果能,请给个详尽的编写,如不能,请教

BAT批处理能否实现16位随机码
在批处理文件中能不能生成16位的随机码,如果能,请给个详尽的编写,如不能,请教调用外部文件生成的16位码的方法,辛苦各位高人了!谢谢!

[解决办法]
给你写了个,应该是你要的效果

BatchFile code
::生成十六位随机码 - Forever_Young@echo off&setlocal enabledelayedexpansionset "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
[解决办法]
BatchFile code
@echo off & setlocal enabledelayedexpansionset s=0123456789ABCDEFset "result="for /l %%a in (1,1,16) do (    set /a r=!random!%%16    call set result=!result!%%s:~!r!,1%%)echo %result%pause 

热点排行