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-08-04 14:19
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Each line in a TXT file is a variable View 812 Replies 3
Original Poster Posted 2007-04-21 07:52 ·  中国 辽宁 丹东 振兴区 电信
初级用户
Credits 36
Posts 13
Joined 2007-01-13 04:24
19-year member
UID 76352
Gender Male
Status Offline
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.
Floor 2 Posted 2007-04-21 07:53 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
The for command...
Floor 3 Posted 2007-04-21 08:05 ·  中国 安徽 芜湖 电信
高级用户
★★
Credits 537
Posts 219
Joined 2006-10-31 21:08
19-year member
UID 69036
Gender Male
From 芜湖
Status Offline
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,
江湖远
碧空长
路茫茫

一个人漫无目的的奔跑,风,刺骨的冷....
Floor 4 Posted 2007-05-13 11:32 ·  中国 广东 深圳 英达通信
初级用户
Credits 25
Posts 19
Joined 2007-03-07 10:51
19-year member
UID 80997
Gender Male
Status Offline
This is a problem``
Please have an expert solve it
Forum Jump: