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-07-14 23:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Excuse me, how to use the command to list the names of the folders under a folder! View 2,910 Replies 8
Original Poster Posted 2006-11-30 06:05 ·  中国 广东 广州 联通
初级用户
Credits 90
Posts 35
Joined 2006-10-23 01:13
19-year member
UID 67781
Gender Male
Status Offline
There is a folder named 1 on drive D. Inside the 1 folder, there are 3 folders: 2, 3, and 4. What command can be used to list the name of each folder per line, with the purpose of comparing 2 folders? Thanks
Floor 2 Posted 2006-11-30 06:13 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
C:\>dir /?
Displays a list of files and subdirectories in a directory.

DIR at
sortorder]]


Specifies the drive, directory

/A Displays files with specified attributes.
attributes D Directory
H Hidden file
S System file
/B Uses bare format (no header information or
/C Shows thousand separator in file sizes.
Disables separator display.
/D Same as wide but files are listed by columns
/L Uses lowercase.
/N New long list format where files
/O Lists files in sorted order.
sortorder N By name (alphabetically)
E By extension (alphabetically)
G Group directories first - Reverse
/P Pauses after each screenful of information.
/Q Displays file owner.
/S Displays specified directory and all subdirectories
/T Controls which time to display or use for sorting
timefield C Creation time
A Last access time
W Last write time
/W Uses wide list format.
/X Displays the short name generated for non 8dot3 filenames
The short name is inserted before the long name. If
displays blank.
/4 Uses four-digit year

You can predefine command options in the DIRCMD environment variable
to override the pre-set command options, for example, /-W.
Floor 3 Posted 2006-11-30 06:15 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
C:\>dir /ad /b
WINNT
Documents and Settings
Program Files
Downloads
Inetpub
Recycled
Floor 4 Posted 2006-11-30 06:45 ·  中国 广东 广州 联通
初级用户
Credits 90
Posts 35
Joined 2006-10-23 01:13
19-year member
UID 67781
Gender Male
Status Offline
Got it, thank you to the two above
Floor 5 Posted 2006-11-30 07:00 ·  中国 广东 广州 联通
初级用户
Credits 90
Posts 35
Joined 2006-10-23 01:13
19-year member
UID 67781
Gender Male
Status Offline
I find that I'm still quite inexperienced. There's another question. There are many lines in a text. How to read one line of text each time, from the first line all the way to the last line!
Floor 6 Posted 2006-11-30 07:05 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
Floor 7 Posted 2006-11-30 07:07 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
对于 (1.txt) 中的每个 %%i 做....
Floor 8 Posted 2006-11-30 07:09 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Brothers and sisters, please try to search before asking questions. Maybe you can find the answer without asking;
Brothers and sisters, please try to be clear when answering questions. We rookies hope to get sincere help.

Thank you for your cooperation.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 9 Posted 2006-12-25 04:16 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Bro, you don't need to follow up on every post. Everyone can see it.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Forum Jump: