Windows OS

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

Graphical User Interface provides ease of use to its users. However, the same operations that we perform with GUI can also be performed by Command Prompt. From opening and manipulating files to fixing and troubleshooting errors, CMD requires a single-line command to perform an operation.

This article demonstrates to find and open a file/folder using CMD in Windows 11

Why Use CMD to Find and Open Files?

CMD is very efficient when it comes to locating files. Instead of going from folder to folder to search for a specific life, you can simply provide the name of the file/folder to CMD and CMD will handle the rest for you. Command Prompt is much faster, more efficient, and more responsive in locating and opening files instead of doing it manually or by Windows Explorer.

How to Find the File/Folder Using CMD?

CMD can search the files that you cannot locate in extensive hierarchies of folders. Furthermore, you can open them, view their content, and save them for later use by using CMD. CMD offers limited functionality but can efficiently perform all the tasks that we perform using GUI.

To find the file/folder, follow the below instructions:

Step 1: Open CMD
From the Start menu, type, and search “CMD” and click on it to open it:

Step 2: Find the File
To find the file/folder we are searching for, provide the following command. The “dir” stands for Directory:

dir "\FinalFile*" /s

Here, it will display the results where the file is present. Also, if any other file/folder is located with the same, it will also enlist it with the name and extension of it:

How to Open a File Using CMD?

CMD can also be used for opening a file. Follow the below steps:

Step 1: Change Path
After CMD has located the file/folder, copied the path, and pasted it with the keyword “cd”. The “cdstands for Change Directory.

For instance, if the file/folder is in the “my docs” directory in the Documents, we will provide the following command:

cd C:\Users\Username\OneDrive\Documents\my docs

Step 2: Provide the File Name
After you are directed to the path mentioned in commands, provide the name of the File/Folder in the commas as mentioned below:

"FinalFile.docx"

Here, the File/Folder that we have provided to CMD is being opened by CMD:

That is all from the guide.

Conclusion

Finding and opening a file/folder is a simple and easy task with CMD by providing single-line commands i.e., “dir “\File Name*” /s” and “File Name”. Here, CMD will enlist all the files/folders with the same name that was located while searching. We can copy the path and change the directory to that path. So that we can modify the file according to our own requirements. This article provides simple methods to achieve this functionality.

About the author

Syed Minhal Abbas

I hold a master's degree in computer science and work as an academic researcher. I am eager to read about new technologies and share them with the rest of the world.