China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 07:05
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Here is a batch script example to generate all 6-digit numbers from 000000 to 999999. Note that this will produce a large number of lines and might take some time to execute depending on your system. ```batch @echo off setlocal enabledelayedexpansion for /l %%a in (0,1,9) do ( for /l %%b in (0,1,9) do ( for /l %%c in (0,1,9) do ( for /l %%d in (0,1,9) do ( for /l %%e in (0,1,9) do ( for /l %%f in (0,1,9) do ( echo %%a%%b%%c%%d%%e%%f ) ) ) ) ) ) endlocal ``` View 1,627 Replies 3
Original Poster Posted 2010-12-12 17:22 ·  中国 山东 济南 电信
初级用户
Credits 63
Posts 33
Joined 2006-12-04 05:49
19-year member
UID 72514
Gender Male
Status Offline
Ask everyone how to use batch processing to generate all numbers between 000000~999999 and save them to a TXT file
Thanks
Floor 2 Posted 2010-12-12 17:32 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
```@echo off&setlocal enabledelayedexpansion
(for /l %%a in (1,1,999999) do (
set a=000000%%a
echo !a:~-6!
))>>1.txt
```
Floor 3 Posted 2010-12-25 12:03 ·  中国 广东 东莞 中移铁通
初级用户
★★
Credits 115
Posts 92
Joined 2010-12-24 16:57
15-year member
UID 179794
Gender Male
Status Offline
Floor 4 Posted 2010-12-25 12:09 ·  中国 湖北 荆门 电信
初级用户
★★
Credits 186
Posts 117
Joined 2006-08-14 14:50
19-year member
UID 60491
Status Offline
for /l %%i in (100000,1,999999) do echo %%i>>a.txt
Forum Jump: