开发者

How to search a hard drive for a directory name using DOS

Is there a way to find a file on the C: of a computer , using a DOS command, without having to CD to the root of the C: drive? I would like to do it using the DIR and the FINDSTR command only.

Ultimately开发者_如何转开发, my goal is to search for a file and then store the parent directory name in a ENV variable without changing directories and hopefully without creating a temp file.


Have a look at How to find a file in MS-DOS.

dir *bob*.* /s 

See also List of DOS commands


This gets the complete file name with directory in a useable form.

dir C:\FILENAME.EXT /s /b


c:> findstr /s /i *.ext REM finds in drive c: every file called *.ext containing (case insensitive)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜