中国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-08-04 15:21
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Each line in a TXT file is a variable
Printable Version  815 / 3
Floor1 haohaopc Posted 2007-04-21 07:52
初级用户 Posts 13 Credits 36
a.txt is as follows



aaaa
bbbb
dddddd
fffff
rrrrr
tttt
yyyy
uuuu
iii
aaa
dddd
ffff


For example, I want to use each line above as the name of a folder.
md %a parameter %a would be the first line. After execution, it goes back and reads again, then %a would be bbbb, and so on in turn.

With each loop, variable a becomes the content of the next line.
Floor2 slore Posted 2007-04-21 07:53
铂金会员 Posts 2,478 Credits 5,212
The for command...
Floor3 huzixuan Posted 2007-04-21 08:05
高级用户 Posts 219 Credits 537 From 芜湖
Here's an example

for /f "delims=" %%i in (a.txt) do md "%%i"

Read each line in a.txt, and at the same time execute the md command,
Floor4 smlz1213 Posted 2007-05-13 11:32
初级用户 Posts 19 Credits 25
This is a problem``
Please have an expert solve it
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023