中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-25 12:49
47,813 topics / 349,918 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » [Help] Batch create folders named 1 to 100
Printable Version  3,479 / 34
Floor16 chenhui530 Posted 2005-03-10 00:00
高级用户 Posts 273 Credits 772
Come on
md 666
cd 666
for %%a in (1 2 3 4 5 6...100) do echo .>&%a.txt
Floor17 7451 Posted 2005-03-10 00:00
初级用户 Posts 16 Credits 140
Please, chenhui530, give me some advice! Thank you!
Floor18 chenhui530 Posted 2005-03-10 00:00
高级用户 Posts 273 Credits 772
I don't have the Windows 98 system, so I can't test what I wrote either.
Floor19 7451 Posted 2005-03-10 00:00
初级用户 Posts 16 Credits 140
Please write more, I'll test it and tell you the result. Let's work together to solve this problem. Do you have confidence??? Greatly appreciate it!!!!
Floor20 chenhui530 Posted 2005-03-10 00:00
高级用户 Posts 273 Credits 772
I thought about it and haven't come up with a way to solve this problem without using third-party tools.
If third-party tools are allowed, you can use STRINGS to complete this operation to make the variable automatically +1. If the variable is greater than 101, it will automatically exit. The code is as follows:
:kaishi
strings a=add %b%,1
if not exist %a% echo 1>%a%.txt
strings b=add %a%,1
if %b%==101 goto end
goto kaishi
:end
Floor21 7451 Posted 2005-03-11 00:00
初级用户 Posts 16 Credits 140
I just tested, it doesn't work! Every time I have to manually edit an empty text document, which is similar to the following code
md 666
cd 666
for %%a in (1 2 3 4 5 6) do copy con %%a.txt Now the key problems to be solved are two 1, how to automatically generate folders or files from (1~100) without manually filling in numbers! 2, how to automatically edit an empty text document Do you have any good methods, let's study together, I believe that without third-party software, DOS batch processing can achieve the expected goal!!!
Floor22 chenhui530 Posted 2005-03-11 00:00
高级用户 Posts 273 Credits 772
: :kaishi
strings a=add %b%,1
if not exist %a% echo 1>%a%.txt
strings b=add %a%,1
if %b%==101 goto end
goto kaishi:end
This is the answer you want呀
Floor23 7451 Posted 2005-03-11 00:00
初级用户 Posts 16 Credits 140
How to automatically edit an empty text document
Floor24 chenhui530 Posted 2005-03-11 00:00
高级用户 Posts 273 Credits 772
Below is the quote of 7451's post on 2005-3-11 9:54:38:
How to automatically edit an empty text document

Please clarify your meaning
Floor25 7451 Posted 2005-03-11 00:00
初级用户 Posts 16 Credits 140
Create an empty text document using batch processing
Floor26 chenhui530 Posted 2005-03-11 00:00
高级用户 Posts 273 Credits 772
The following is a quote from 7451's post on 2005-3-11 14:31:30:
Create an empty text document using batch processing

This problem is relatively difficult. It's difficult with DOS but very simple using other scripting languages
Floor27 Climbing Posted 2005-03-11 00:00
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
1. It is suggested that the original poster (LZ) write a good title for the post. Such titles are the most likely to be overlooked. Please refer to the link in my signature.
2. Regarding your question: The way "for %%a in (1 2 3 4 5 6...100) do md %%a" is definitely not feasible because the command line exceeds the limit of 255 characters. It can be considered to separate the for command and write it in several parts.
md 666
cd 666
for %%a in (1 2 3 4 5 6...100) do echo %%a>%%a.txt
The above commands should be run in a batch file. If run directly in the command line, %%a should be changed to %a. These are all basics of DOS. It is suggested that the original poster first study the post "Hand-in-Hand to Write Batch Files for You".
Floor28 ebfok Posted 2006-06-20 15:48
初级用户 Posts 33 Credits 87 From cs
Dim fso, f, n
n = InputBox("Please enter the number of folders to create:")
Set fso = CreateObject("Scripting.FileSystemObject")
For i = 1 To n
Set f = fso.CreateFolder(i)
Next
Floor29 bagpipe Posted 2006-06-20 16:53
银牌会员 Posts 425 Credits 1,144 From 北京
md 666
cd 666
md 1 2 3 4 5 6 7 8 9.....50
md 51 52 53 54 ......100

I don't know if it will work. It should be okay on systems above 2000. I don't know if it works on 98.
Floor30 kcdsw Posted 2006-06-21 09:17
中级用户 Posts 179 Credits 404
```
for %%a in (1 2 3 4 5 6 7 8 9) do for %%b in (1 2 3 4 5 6 7 8 9 0) do ( md %%a%%b ) & (md %%b) & (ren 0 100)
```
Prev  1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023