tags:

views:

126

answers:

3

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.

A: 

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

dir C:\FILENAME.EXT /s /b
Jeffrey L Whitledge
yes indeed. thats it. i didn't realize the /b option did that. thanks, thats what I needed.
djangofan
actual command I used was: dir c:\dirname /s /b /AD
djangofan
+2  A: 

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

dir *bob*.* /s 

See also List of DOS commands

astander
A: 

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

Korian