The basic command to open a file in Command Prompt

To open a file from Command Prompt, type the full path to the file after the command that matches what kind of file it is. For a text file, that command is type. For example, if you have a file called notes.txt on your Desktop, you would type type C:\Users\YourUsername\Desktop\notes.txt and press Enter. The file contents will display in the window.

If you want to open a file in its default program instead of just viewing it in Command Prompt, use the start command. Type start C:\Users\YourUsername\Desktop\notes.txt and the file will open in Notepad or whatever program your computer has set as the default for .txt files.

The difference matters: type shows you the contents without leaving Command Prompt. start launches the file in another program, and Command Prompt returns to the prompt so you can type more commands.

Key Takeaways

  • Use type followed by the full file path to view a text file's contents directly in Command Prompt.
  • Use start followed by the full file path to open a file in its default program.
  • You must know the complete path to the file, starting from C:\ or another drive letter, or Command Prompt will not find it.
  • If the file path contains spaces, wrap the entire path in quotation marks so Command Prompt reads it as one instruction.
  • You can navigate to a folder first using cd, then use just the filename instead of the full path.

Finding the full path to your file

Command Prompt needs the complete address of the file, not just the filename. If you type only type notes.txt, Command Prompt will look for that file in whatever folder you are currently in. If the file is somewhere else, you get an error.

The easiest way to get the full path is to open File Explorer, find your file, right-click it, and select Properties. The Location field shows the folder path. Copy that, add a backslash, then add the filename. For example: C:\Users\YourUsername\Desktop\notes.txt.

Another method: in File Explorer, click the address bar at the top (it shows the folder path), copy the text, then paste it into Command Prompt. Add a backslash and the filename at the end.

Handling filenames and paths with spaces

If your filename or any folder in the path contains a space, Command Prompt will misread it. For example, type C:\Users\Your Username\Desktop\my notes.txt will fail because Command Prompt sees "Your" as one thing and "Username" as another.

Wrap the entire path in quotation marks to fix this: type "C:\Users\Your Username\Desktop\my notes.txt". The quotation marks tell Command Prompt to treat everything inside as a single path, spaces and all.

This applies to both type and start commands. If you are unsure whether your path has spaces, using quotation marks does no harm — Command Prompt will accept them either way.

Using the cd command to navigate first

Instead of typing the full path every time, you can navigate to the folder where your file lives, then use just the filename. The cd command (short for "change directory") moves you to a different folder.

Type cd C:\Users\YourUsername\Desktop and press Enter. Command Prompt now shows that folder in the prompt. Now you can type type notes.txt or start notes.txt without the full path.

To go back to the parent folder, type cd .. (two periods). To see what files are in your current folder, type dir and press Enter. This helps you confirm the filename before you try to open it.

Opening different file types

The type command works for plain text files: .txt, .csv, .log, and similar formats. For other file types, use start instead. Type start document.docx and Word will open. Type start image.jpg and your default image viewer will open.

Some file types will not open with start if no default program is set. For example, if you have never opened a .zip file before, Command Prompt may not know what to do with it. In that case, you can right-click the file in File Explorer and choose "Open with" to set a default program first.

For executable files (.exe), you can type just the filename if you are in the same folder: program.exe. For files in other folders, use start C:\path\to\program.exe.

Troubleshooting when a file will not open

If you get an error like "The system cannot find the file specified," the path is wrong. Check the spelling of every folder name and the filename. Capitalization does not matter in Windows, but spelling does. Copy the path from File Explorer instead of typing it by hand.

If the file opens but shows garbage characters or looks corrupted, you may have used type on a file that is not plain text. Binary files like .exe, .jpg, or .docx will display as nonsense in Command Prompt. Use start instead to open them in the correct program.

If you see "Access is denied," the file may be open in another program, or your user account does not have permission to read it. Close any other programs using the file, or ask your system administrator for permission.

Frequently Asked Questions

What is the difference between type and start?

type displays the file contents inside Command Prompt itself and works only for plain text files. start opens the file in its default program (like Notepad or Word) and closes the file when you close that program. Use type to read quickly; use start to edit or view formatted files.

Do I have to use the full path every time?

No. Use cd to navigate to the folder where your file is, then you can use just the filename. For example, cd C:\Users\YourUsername\Desktop followed by type notes.txt works the same as typing the full path.

What if my file is on a different drive, like D: or E:?

Type the drive letter first: d: and press Enter to switch to the D: drive. Then use cd to navigate to your folder, or type the full path starting with D:\ instead of C:\.

Can I open a file without knowing the exact spelling?

Use the dir command to list all files in a folder. Type dir to see what is in your current folder, or dir C:\path\to\folder to see files in another folder. This shows you the exact spelling and file extension.

What does it mean if Command Prompt says "is not recognized as an internal or external command"?

This usually means you typed the command wrong, or the file is not where you said it is. Check the spelling of the command (type or start) and the file path. If the path has spaces, make sure it is in quotation marks.