Helping millions of people navigate the world of technology.

How to Open Files and Folders in CMD on Windows

Quick Tips
  • Open CMD, enter cd followed by the folder path to change the directory to the folder you want to open.
  • Enter start to open the folder after you change the directory.
  • To open a file, change the directory, and then enter the file path to open the file.

How to Open a File Using Command Prompt on Windows

Here’s how you can easily open Command Prompt on your PC and use it to access a file. However, you must know the file’s path on your PC before proceeding with the steps.

Step 1: Open the Command Prompt app from the start menu.

Open Command Prompt 17

Step 2: Now, type cd, followed by folder path, and hit enter.

cd "folder_path"

To copy the path of any folder, right-click on the folder and click on ‘Copy as Path’. Our folder path here is “C:\Users\rsupr\OneDrive\Desktop\Sample Folder”.

Note: Ensure to enter all the paths within double quotes.

Enter Folder Path

Step 3: Next, enter the file name and its extension in double-quotes.

The name of the file we are using is “Sample Image” and its extension is “.png”.

Step 4: Hit the enter key, and the file will open.

Open File in CMD

Also Read: Create a folder or file from Windows Command Prompt

How to Open a Folder Using Command Prompt

Step 1: Open the Command Prompt app from the start menu.

Open Command Prompt 17

Step 2: Now, type cd and paste the path of the folder you want to open. Once done, hit enter.

cd "folder_path"

To copy the path of any folder, right-click on the folder and click on ‘Copy as Path’. Our folder path here is “C:\Users\rsupr\OneDrive\Desktop\Sample Folder”.

Note: Ensure to enter all the paths within double quotes.

Enter Folder Path

Step 3: Next, enter the following command to open the folder on your PC. Hit the enter key.

start .
Open Folder

How to Delete Files Using CMD on Windows

You can also delete files using simple commands on CMD in Windows. However, this permanently deletes the file, so proceed with caution.

1. Delete Individual File

Step 1: Open the Command Prompt app from the start menu.

Open Command Prompt 17

Step 2: Now, type cd, followed by the file’s path you want to delete. Hit the enter key.

cd "folder_path"

To copy the path of any folder, right-click on the folder and click on ‘Copy as Path’. Our folder path here is “C:\Users\rsupr\OneDrive\Desktop\Sample Folder”.

Note: Ensure to enter all the paths within double quotes.

Enter Folder Path 1

Step 3: Type del followed by the name of the file you want to delete. Hit the enter key.

Ensure to enter the filename and its extension within double quotes. The name and extension of the file we are using are “Sample Image” and “.png”.

Delete File in CMD

2. Delete All Files Within a Folder

You can also permanently delete a folder’s contents at once using a single command. Here’s how:

Step 1: Open the Command Prompt app from the start menu.

Open Command Prompt 17

Step 2: Now, type del and paste the path of the folder whose contents you want to delete. Hit the enter key.

del "folder_path"

To copy the path of any folder, right-click on the folder and click on ‘Copy as Path’. Our folder path here is “C:\Users\rsupr\OneDrive\Desktop\Sample Folder”.

Delete Folder

Step 3: Type ‘Y’ to confirm your action or ‘N’ to abort the process and hit the enter key.

Type Y or N

Also Read: How to view Command Prompt (CMD) history on Windows.

Bonus: Copy or Move Files to Different Locations Using CMD

You can also copy or move files from one destination to another on your Windows PC within CMD. Here’s how:

Step 1: Open Command Prompt from the start menu.

Open Command Prompt 17

Step 2: Now, type cd and paste the path of the file you want to copy or move. Hit the enter key.

cd "folder_path"

To copy the path of any folder, right-click on the folder and click on ‘Copy as Path’. Our folder path here is “C:\Users\rsupr\OneDrive\Desktop\Sample Folder”.

Enter Folder Path 2
  • To copy a file to a different location, type copy and the source file’s name and the destination folder’s path. Once done, press enter.
copy "filename.extension" "destination_path"

Our file is “Sample Image.png” and the destination path is “C:\Users\rsupr\OneDrive\Documents”.

Note: Ensure to enter all the paths, the filename, and its extension within double quotes.

File Copied

Note: If a file of the same name exists in the destination folder, you will receive a prompt whether you want to overwrite the file or abort the process. Type Y (yes) to overwrite or N (no) to abort, and hit enter.

Copy Prompt
  • To move a file to a different location, type move, followed by the source file’s name and the destination folder’s path. Now, hit enter.
move "filename.extension" "destination_path"

Our file is “Sample Image.png” and the destination path is “C:\Users\rsupr\OneDrive\Documents”.

Note: Ensure to enter all the paths, the filename, and its extension within double quotes

Move File Using CMD 1

Note: If a file of the same name exists in the destination folder, you will receive a prompt whether you want to overwrite the file or abort the process. Type Y (yes) to overwrite or N (no) to abort and hit enter key.

Move Prompt

That is everything you need to know on how to open files and folders using CMD on Windows. If you have any further questions, move to the following section.

FAQs on Opening Files Using Command Prompt

1. Do I need to open Command Prompt as an administrator to open files?

No, you do not need to open Command Prompt as an administrator to open, delete, move/copy files on your Windows PC.

2. Why is CMD showing errors when I am trying to open a file?

Ensure you use the ‘cd’ command before entering a directory. Further, ensure that all paths and filenames are enclosed within double quotes. Make sure to include the extension of the filename as well.

3. How to open a folder using CMD?

All you need to do is to type ‘cd’ and enter the path of the folder in double quotes. This will open the folder to CMD, and you can type the file names present in the folder to open it.

4. How do I find the full name of a file along with its extension?

Right-click on the filename, select properties, and select the General tab. You can see the file’s full name and its extension in the ‘Type of File’ section.

Was this helpful?

Thanks for your feedback!

Last updated on 14 August, 2024

Leave a Reply

Your email address will not be published. Required fields are marked *

The article above may contain affiliate links which help support Guiding Tech. The content remains unbiased and authentic and will never affect our editorial integrity.