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 04:44
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to search for files whose names contain a specific string? View 819 Replies 3
Original Poster Posted 2008-01-06 11:06 ·  中国 广东 东莞 电信
初级用户
Credits 49
Posts 24
Joined 2007-12-03 21:34
18-year member
UID 104583
Gender Male
Status Offline
For example, I want to search for txt files on drive F whose filenames contain 123, and then save the results as a.txt
For example, if F contains abc.txt, 1234.txt, 2008.txt, 01123.txt, 312325.txt
I want to find 1234.txt, 01123.txt, 312325.txt
Please explain it!
Floor 2 Posted 2008-01-06 13:26 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,282
Posts 538
Joined 2002-11-02 00:00
23-year member
UID 129
Gender Male
Status Offline
The form is roughly like this (since I haven't fully mastered it yet), so mistakes are unavoidable! For reference only:

for %a in ('dir *.txt /b^|find /v "123"') do echo %a>>a.txt
Floor 3 Posted 2008-01-06 17:21 ·  中国 湖北 武汉 电信
中级用户
★★
Credits 471
Posts 207
Joined 2007-05-03 14:53
19-year member
UID 87369
Gender Male
Status Offline
Floor 4 Posted 2008-01-08 11:35 ·  中国 广东 东莞 电信
初级用户
Credits 49
Posts 24
Joined 2007-12-03 21:34
18-year member
UID 104583
Gender Male
Status Offline
Originally posted by ThinKing at 2008-1-6 05:21 PM:
dir /s/b/a-d F:\*123*.txt>a.txt

Thanks so much!
Forum Jump: