How to Find and Open Files Using Command Prompt in Windows 11

Command Prompt (CMD) remains one of the most powerful tools in Windows 11 — even in an age of modern graphical interfaces. Whether you’re trying to locate files faster, automate tasks, troubleshoot system problems, or simply prefer a keyboard-driven workflow, knowing how to find and open files using CMD can save you time and give you more control over your file system.

If you’re here reading this guide, you’re probably curious about searching for files the “old-school” way or you need to run a file directly through the command line. The good news? CMD offers several commands that help you quickly find, list, open, and work with files.

In this in-depth guide, we walk you through all the methods to find and open files using Command Prompt in Windows 11, from basic directory searches to advanced filtering. Let’s get started!

Why Use Command Prompt to Find Files?

Using CMD gives you advantages like:

  • Faster searches on large file systems
  • Ability to filter results precisely
  • Running commands on matching files
  • Working when Windows Explorer is not responding
  • Searching remote drives and partitions
  • Opening files directly from the terminal

If you’re troubleshooting or managing a complex directory structure, CMD is often quicker than using the GUI.

1. Open Command Prompt in Windows 11

Before anything else, let’s open CMD.

Using Windows Search

  1. Press Windows + S.
  2. Type cmd.
  3. Click Command Prompt or select Run as administrator if needed.

Using Run Command

  1. Press Windows + R.
  2. Type:
cmd
  1. Press Enter.

2. Change Directories Before Searching

It’s easier to search when you’re inside the correct folder.

Use the cd command:

cd path\to\folder

Examples:

cd C:\Users\YourName\Documents

To move up one folder:

cd ..

To jump directly to the root:

cd \

3. Find Files Using the DIR Command (Basic Search)

The simplest way to search for files is using dir, which lists folder contents.

Example 1: Search for a file by name

dir filename.ext /s

Example:

dir report.docx /s

This searches the entire drive for report.docx.

Example 2: Search for a file by partial name

dir *report* /s

Example 3: Search by extension

dir *.pdf /s

This will scan all subfolders and list every PDF file.

Useful DIR switches:

  • /s → search all subdirectories
  • /b → output minimal results
  • /o:n → sort alphabetically

Example:

dir *.jpg /s /b

This lists all JPG files with clean output — perfect for scripting.

4. Use the WHERE Command (Fast and Precise Search)

The where command behaves like Linux’s “which” or “locate.” It’s faster than dir and can search system paths automatically.

Example 1: Find a file in a directory tree

where /r C:\ *.txt

This recursively searches for all TXT files inside C:.

Example 2: Find a specific file

where /r C:\Users\YourName Downloads.pdf

Example 3: Search for executables

where notepad

CMD will show you the full path of Notepad.

5. Open a File Directly from Command Prompt

Once you find the file path, opening it is easy.

Using the START Command

start "" "C:\path\to\file.ext"

Example:

start "" "C:\Users\YourName\Documents\notes.txt"

This opens the file with its default application.

Using the file name (executables only)

If you’re inside the folder:

exampleapp.exe

This runs the program directly.

Open a folder path

start "" "C:\Users\YourName\Pictures"

This opens the folder in File Explorer.

6. Search for Text Inside Files (Advanced Use)

CMD lets you find text inside files using findstr.

Example: Search for a word in TXT files

findstr /s /i "keyword" *.txt

Switches:

  • /s → search subdirectories
  • /i → ignore case
  • /n → show line number

Example: Find function names inside code files

findstr /s /i "function" *.py

This is incredibly useful for programmers and IT professionals.

7. View File Details with the ATTRIB Command

If you want more metadata about a file:

attrib "C:\path\to\file.ext"

This shows attributes like:

  • Hidden
  • Read-only
  • System file

8. Combine Commands for Power Search (Professional Technique)

You can combine dir, find, and start for advanced searches.

Example: Find all PNG files and open the result folder

dir *.png /s | find "Directory of"

This lists only the directories where PNGs exist.

You can also pipe output to a text file:

dir *.mp4 /s /b > videos.txt

Now you have a clean list of all MP4 files on your system.

Wrapping Up

Finding and opening files through Command Prompt in Windows 11 is both powerful and efficient. Whether you’re locating documents, launching programs, scanning directories, or filtering through thousands of files, CMD gives you full control with fast results and flexible commands.

In this guide, we explored everything from basic file searches to advanced command combinations that help you manage your system more effectively. Once you master these commands, you’ll navigate Windows like a pro — even when Explorer isn’t cooperating.

Posted by Arpita

With a background in Computer Science, she is passionate about sharing practical programming tips and tech know-how. From writing clean code to solving everyday tech problems, she breaks down complex topics into approachable guides that help others learn and grow.