Find Files with Dir Command Prompt

The Dir command provides a host of ways to locate files on your hard drive. Because Dir can check the entire drive, the results are often more accurate than provided with the Windows search mechanisms. In addition, you can sort files as needed (see the “Find Files in Sorted Order” section for details) and locate files based on their attributes (see the “Find Files by Attribute” section for details). The Dir command also supports a number of display options, such as the /X command line switch that shows you the 8.3 (8 dot 3) display name for files used in the registry. Type Dir /? and press Enter to see a complete list of options.

Use these steps to perform a basic search for files.

1. Type Dir Filename, where Filename is the name of the file you want to locate.
(You can optionally add an absolute or relative path to the file specification.)

2. (Optional) Type /S if the file is in a subdirectory.

3. (Optional) Type /B if you want the file listing displayed without the usual header information.

4. (Optional) Type /P if you expect to see more than one screen of file listings and want the Dir command to pause after each screen.

5. (Optional) Type /Q if you want to see the owner of the file.

6. (Optional) Type /R if you want to see the alternate streams in a file that contains multiple streams. (Multiple stream files contain data in a sectionalized manner and are somewhat rare, even in newer systems.)

7. (Optional) Type /W if you want to see just a list of filenames in the shortest space possible (in tabular format, three to six filenames across).

8. (Optional) Type /X if you want to see the 8.3 filenames alongside the longer filenames. For example, the Program Files directory becomes PROGRA~1 in 8.3 format and My Interesting File.TXT becomes MYINTE~1.TXT. Files such as Desktop.INI are already in 8.3 format, so they don’t have an 8.3 equivalent.

9. Press Enter.

The Dir command shows zero or more files using the criteria you selected. Of course, you only see a file displayed if the file exists.

No comments:

Post a Comment