标题: [文本处理] 批处理怎样批量生成域名? [打印本页]
作者: tan1967 时间: 2011-8-18 09:33 标题: 批处理怎样批量生成域名?
XXXXX.163.COM
XXXXX代表随机生成5位数字与英文组合.然后生成1万行在文本里
作者: yhp1996 时间: 2011-8-18 12:50
借鉴了一下别人的代码:http://www.bathome.net/redirect. ... amp;goto=nextoldset
我很菜鸟,只能写出这种毫无效率的代码- @echo off
- set num=0
- :start
- if /i %num%==10000 exit
- set str=abcdefghijklmnopqrstuvwxyz
- set /a a=%random%%%26
- set /a b=%random%%%10
- set /a c=%random%%%26
- set /a d=%random%%%10
- set /a e=%random%%%26
- call echo %%str:~%a%,1%%%b%%%str:~%c%,1%%%d%%%str:~%e%,1%%.163.COM>>ID.txt
- set /a num=%num%+1>nul
- goto start
复制代码
很慢的,大约要2分钟,做好心理准备
作者: CUer 时间: 2011-8-18 22:20
回复 2# yhp1996
改成这样会快些吧:- @echo off
- setlocal enabledelayedexpansion
- set num=0
- set str=abcdefghijklmnopqrstuvwxyz
- :start
- if %num%==10000 goto :eof
- set /a a=%random%%%26
- set /a b=%random%%%10
- set /a c=%random%%%26
- set /a d=%random%%%10
- set /a e=%random%%%26
- echo !str:~%a%,1!%b%!str:~%c%,1!%d%!str:~%e%,1!.163.COM>>ID.txt
- set /a num+=1
- goto :start
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |