开发者

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

开发者 https://www.devze.com 2022-12-21 11:14 出处:网络
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 FINDSTRcommand only.

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

精彩评论

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

关注公众号