To open a file using the Command Prompt (cmd), you can use the `start` command followed by the file path, as shown below:
start C:\path\to\your\file.txt
Understanding CMD Basics
What is CMD?
The Command Prompt, commonly referred to as CMD, is a command-line interface in Windows that allows users to execute commands to perform various tasks directly through the text interface. It provides powerful functionalities that enable users to manage their files, automate tasks, and perform system-level operations with precision.
Why Use CMD to Open Files?
There are several scenarios where using CMD to open files is advantageous:
- Speed: CMD allows for quicker access to files without navigating through graphical interfaces.
- Precision: When you need to work with multiple files or specific file types, CMD streamlines the process with exact commands.
- Remote Access: CMD commands can be executed on remote systems, making it essential for network administrators and IT professionals.

Prerequisites
Basic CMD Knowledge
Before diving into how to open a file on CMD, it helps to have a basic understanding of CMD commands and navigation principles. Familiarity with commands like `cd` (change directory), `dir` (list directory contents), and file path syntax is highly beneficial.
Accessing CMD
Opening the Command Prompt is easy. You can do this through:
- Windows Search: Type "cmd" or "Command Prompt" in the search bar and hit Enter.
- Run Dialog: Press `Win + R`, type `cmd`, and click OK.

Ways to Open Files using CMD
Using the `start` Command
The `start` command is a versatile way to open files in their default applications. This command initiates a separate window for the application that opens your file.
Example Syntax:
start <filename>
Example Usage:
start example.txt
This command opens `example.txt` in your default text editor. It's great for quickly accessing files without needing to type the editor's name.
Using the `notepad` Command
If you specifically want to open a text file in Notepad, you can utilize the `notepad` command.
Example Syntax:
notepad <filename>
Example Usage:
notepad example.txt
This command is particularly useful if you need to edit the contents of a text file, quickly allowing you to view and modify its content.
Using the `type` Command
If your goal is to simply view the contents of a file without opening it in an editor, the `type` command allows you to display the file's contents directly in the Command Prompt.
Example Syntax:
type <filename>
Example Usage:
type example.txt
This command reads and outputs the file's contents, but it does not allow any editing. This can be helpful for quickly checking the content of logs or configuration files.
Using the `call` Command for Batch Files
In cases where you're working with batch scripts (.bat), the `call` command enables you to run the script and return to the CMD prompt afterward.
Example Syntax:
call <filename.bat>
Example Usage:
call script.bat
This is useful for executing a series of commands from a script without exiting the CMD session.
Opening Non-Text Files (Images, PDFs, etc.)
CMD can also handle non-text files such as images or PDFs using the `start` command. This will open the file in its associated application.
Example Syntax:
start <file.extension>
Example Usage:
start image.jpg
This command will launch the default image viewer for Windows to display the specified image.

Tips for Efficient File Management
Navigating Directories
Navigating to the correct directory is essential when you want to open files. Use the `cd` (change directory) command to move to the location where your file is stored.
Example:
cd C:\Users\YourUsername\Documents
This command will move you to your Documents folder, making it easier to access files stored there.
Opening Files in Specific Directories
To open files located in other directories without changing the current directory, you can provide the full path to the file.
Example:
notepad C:\Users\YourUsername\Documents\example.txt
This command directly opens the specified text file in Notepad, regardless of your current CMD location.
Checking File Availability
Before attempting to open a file, it’s wise to check if the file exists in the specified directory. You can use the `dir` command to list the files in the current directory.
Example:
dir
Running this command provides a current list of files and folders, allowing you to confirm the presence of your target file.

Troubleshooting Common Issues
File Not Found Error
If you receive a "File Not Found" error, this could mean that the file does not exist in the specified directory. Double-check the file path and spelling to ensure accuracy.
Permission Denied
Sometimes, you may encounter a "Permission Denied" message. To resolve this, ensure that you have the required permissions to access the file. You may need to run CMD as an administrator if the file requires elevated privileges.
Unsupported Format
If you try to open a file type that doesn't have an associated default program or is not supported, CMD won't be able to open it. In this case, make sure that the file format is compatible with installed applications.

Conclusion
In this guide, you have learned various methods for how to open a file on CMD, ranging from using the `start` command for launching files in their default programs to employing the `notepad` command for editable files. By mastering these techniques, you can streamline your workflow and enhance your command-line proficiency. Remember to practice using CMD to solidify your understanding and confidence in navigating and managing files efficiently.