In this guide, I have explained how to open files on Windows 11 using Command Prompt. You can also perform various other tasks related to files such as deleting a file or copying a file in a folder. Using Command Prompt, you can also access folders on your PC hard drive.
To perform any action with files or folders on Windows 11, you do not need administrator access to Command Prompt. Most Windows users prefer File Explorer to access their hard drive content. However, it is equally convenient to manage file operations on Windows using the Command Prompt.
How do you Open a File using Command Prompt?
You have to enter the complete path of the folder where the file you want to open is located. Here are the steps for you. Follow the screenshots to implement the commands with ease.
- Launch Command Prompt. Press Win + S hotkeys and type cmd in the search box.
- Enter the path of the folder and press enter to access it.
cd"folder_path" [replace folder path with the actual path name]
- Once the folder access shows up, enter the file name in double quotes.
- Press the enter key to execute the command.
NOTE: In the above steps, when you are entering the folder path, make sure to wrap it within double quotes.
I am accessing a folder named “c language notes” in the above screenshot. Within that folder, I have opened a file named “comments.jpg”.
How do you Delete One or More Files in Windows 11 using a Command Prompt?
To permanently delete one file or all files in a folder, you can use the Command Prompt.
Deleting a Single File
- Open Command Prompt on your PC.
- Enter the folder path in which the file is located.
cd "folder_path"
- Provide the following command to delete a file.
del "filename.extension"
NOTE: The filename and its extension must be wrapped within double quotation marks in the above command.
Delete All Files in a Folder
To delete all files within a folder using Command Prompt, follow these steps.
- Press Win + R followed by typing cmd. Press enter to open the Command prompt.
- Enter the command.
del "folder_path"
- Press enter.
- Press Y to proceed with the deletion or Press N to abort the action.
The delete command followed by the folder path will delete all the content within that folder. Remember that this action will permanently remove the files from your PC drive. You cannot revert this action.
Copy a File Using the Command Prompt
To copy a file from a folder, you have to access the folder by specifying the folder path. You can then initiate the command to copy a file.
- Press the Windows key and type cmd in the Windows search.
- Click Open.
- To access the folder, enter the command and press enter.
cd "folder_path"
- To copy a file, provide the following command.
copy "filename.extension" "destination_path"
- Press enter to execute the command.
The destination path is the folder to which the file will be copied. If the destination folder already has a file of the same name as the one being copied, you will come across a prompt.
Press Y to proceed with copying the file and overwriting the existing file of the same name in the target folder. To cancel the process, press N on your keyboard.
Move a File Using Command Prompt
- Press Win + S to bring up the search console and type cmd.
- Click Open.
- To access the folder, enter the command and press enter.
cd "folder_path"
- To move a file, enter the following command.
move "filename.extension" "destination_path"
Even while moving a file across folders, if another file is in the target folder of the same name, you may overwrite it or cancel moving the file.
Frequently Asked Questions(FAQs)
Is Opening Files and Folders on Command Prompt Supported on All Windows OS?
Yes. You can open files and folders using Command Prompt on any Windows OS,
Do I need to use Command Prompt with Administrator Access to Open Files or Folders?
Using general access and administrator privilege, you can open files and folders on Command Prompt.
The Commands to Open Files or Folders are not Working on CMD
Always keep the folder path and filename(with extension) within double quotes in a command. Make sure to check the spelling of the filename before executing the command. Also, enter the correct path of the folder.
Bottom Line
If you are looking for creative ways to manage basic file operations or view a file on Windows, I suggest using Command Prompt. Accessing and managing files will be a breeze on the command line tool as long as you issue the correct command with proper syntax.
If you've any thoughts on How to Open Files and Folders in CMD on Windows, then feel free to drop in below comment box. Also, please subscribe to our DigitBin YouTube channel for videos tutorials. Cheers!