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)
精彩评论