How to Open Files and Folders in CMD on Windows

Supreeth is passionate about technology and dedicates himself to helping people figure it out. An engineer by education, his understanding of the inner workings of all types of gadgets and devices ensures he provides top-notch guidance, tips, and recommendations to his readers. When away from the desk, you will find him traveling, playing FIFA, or hunting for a good movie.

How to Open a File Using Command Prompt on Windows

Here’s how you can easily openCommand Prompton 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 theCommand Prompt appfrom the start menu.

Step 2:Now, typecd, followed byfolder path, and hit enter.

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.

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

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

Step 4:Hit theenterkey, and the file will open.

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

How to Open a Folder Using Command Prompt

Step 1:Open theCommand Prompt appfrom the start menu.

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

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.

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

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 theCommand Promptapp from the start menu.

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

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.

Step 3:Typedelfollowed 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”.

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 theCommand Promptapp from the start menu.

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

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”.

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

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:OpenCommand Promptfrom the start menu.

Step 2:Now, typecdandpaste the path of the fileyou want to copy or move. Hit theenter key.

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”.

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.

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. TypeY(yes) to overwrite orN(no) to abort, and hit enter.

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

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. TypeY(yes) to overwrite orN(no) to abort and hit enter key.

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

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

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.

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.

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?

Last updated on 14 August, 2024

Leave a ReplyCancel reply

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

Name*

Email*

Comment*

Δ

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.

More in Windows

7 Ways to Fix Red Light Error on Motherboard

How to Change Font Style in Microsoft Outlook

JOIN THE NEWSLETTER

Get Guiding Tech articles delivered to your inbox.

© 2024 Guiding Tech Media. All Rights Reserved.