标题: [已解决] 产生全系列硬盘序列号
[打印本页]
作者: chishingchan
时间: 2008-7-8 13:42
标题: [已解决] 产生全系列硬盘序列号
现在想编个批处理,要求生成 0000-0000 至 FFFF-FFFF。
但在生成的过程中,每生成一个就要暂停,请问如何编写?
产生的个数是否8的8次方=16777216个?
如果将此个数分成十六份,让十六每台电脑分摊运行,批处理该如何写呢?
[
Last edited by chishingchan on 2008-7-18 at 10:17 AM ]
作者: chishingchan
时间: 2008-7-8 21:39
8的8次方这个数是错的。
应该是FFFFFFFF的十进制数:4294967295个数。
产生的效果如下:
0000-0000
请按任意键继续. . .
0000-0001
请按任意键继续. . .
0000-0002
请按任意键继续. . .
.
.
0000-0009
请按任意键继续. . .
0000-000A
请按任意键继续. . .
.
.
0000-000F
请按任意键继续. . .
0000-0010
请按任意键继续. . .
.
.
.
FFFF-FFFF
请按任意键继续. . .
[
Last edited by chishingchan on 2008-7-8 at 09:42 PM ]
作者: lxmxn
时间: 2008-7-8 22:55
很简单……
@echo off
set list%=0 1 2 3 4 5 6 7 8 9 A B C D E F
for %%a in (%list%) do (
for %%b in (%list%) do (
for %%c in (%list%) do (
for %%d in (%list%) do (
for %%e in (%list%) do (
for %%f in (%list%) do (
for %%g in (%list%) do (
for %%h in (%list%) do (
echo.%%a%%b%%c%%d-%%e%%f%%g%%h&pause
)
)
)
)
)
)
)
)
)
[
Last edited by lxmxn on 2008-7-8 at 11:01 PM ]
作者: chishingchan
时间: 2008-7-9 22:34
谢谢!正解。
不明白的地方:list%=
因为序列号太多,所以想分开若干台电脑运行,每台运行不同的部分,请问如何修改呢?
[
Last edited by chishingchan on 2008-7-9 at 10:36 PM ]
作者: lxmxn
时间: 2008-7-9 22:45
这个要看你分成几台电脑运行了,可以将最外层的循环拆分成8个或者十六个,分别给8或者16台机器运行,每台只负责后面的7位。
作者: chishingchan
时间: 2008-7-14 13:27
Quote: |
Originally posted by lxmxn at 2008-7-9 10:45 PM:
这个要看你分成几台电脑运行了,可以将最外层的循环拆分成8个或者十六个,分别给8或者16台机器运行,每台只负责后面的7位。 |
|
请教版主具体代码如何?
作者: lxmxn
时间: 2008-7-14 13:50
Quote: |
Originally posted by chishingchan at 2008-7-14 13:27:
请教版主具体代码如何? |
|
比如将任务分成16份,A主机负责处理Axxx-xxxx,那么代码就是:
@echo off
set list%=0 1 2 3 4 5 6 7 8 9 A B C D E F
for %%b in (%list%) do (
for %%c in (%list%) do (
for %%d in (%list%) do (
for %%e in (%list%) do (
for %%f in (%list%) do (
for %%g in (%list%) do (
for %%h in (%list%) do (
echo.A%%b%%c%%d-%%e%%f%%g%%h&pause
)
)
)
)
)
)
)
)
作者: chishingchan
时间: 2008-7-18 10:17
谢谢!