Into Windows

  • Home
  • Windows 11
  • Windows 10
  • Windows 7
  • Privacy
You are here: Home » Windows 10 » How To Delete A File From Command Prompt

How To Delete A File From Command Prompt

Last Updated on June 15, 2016 by admin Leave a Comment

Deleting a file is extremely easy in Windows or any other operating system for that matter. In Windows, you just have to right-click on the file and then click Delete option. One can also delete a file by selecting the same before pressing the Delete key.

But at times you might come across a file that can’t be easily deleted with the click of mouse button. Of course, there are number of free applications out there to help you delete a file that can’t be deleted otherwise by selecting or right-clicking on it, but more often than not files that can’t be deleted from Windows Explorer can be deleted from Command Prompt without installing third-party applications. And if you have never used the Command Prompt before, truest me, it’s not as difficult as it sounds.

Delete a file from Command Prompt in Windows picture001

Follow the given below instructions to delete a file from the Command Line in all versions of Windows.

WARNINIG: When you delete a file from the command line, the file will not be put into the Recycle Bin, which means that the file will be deleted permanently and can’t be restored from the Recycle Bin. So make sure that you no longer need the file or back it up before deleting it.

Using Command Prompt to delete a file

Step 1: In order to delete a file from Command Prompt, we recommend you open elevated Command Prompt. To do so, launch Command Prompt as administrator by typing CMD in Start menu or Start screen dialog box and then simultaneously pressing Ctrl + Shift + Enter keys.

Delete a file from Command Prompt in Windows picture02

Note that if you aren’t the admin and can’t open elevated Command Prompt, you can also try deleting the file by opening normal Command Prompt.

Step 2: To delete a specific file, you need to know the path to the file first. That is, you need to know where the file is located exactly. To know the path to the file, hold down the Shift key before right-clicking the on the file and then click Copy as path option to copy the path.

Delete a file from Command Prompt in Windows picture03

Step 3: Next, execute the following command to delete the file:

Del pathtothefile

Ex: Del “E:\Test\Machine\Rain.txt ”

Delete a file from Command Prompt in Windows picture01

Command Prompt in Windows 7/8/8.1 doesn’t allow you paste using Ctrl + V command. You need to right-click and then click Paste option. However, in Windows 10, you can paste the path by pressing Ctrl + V hotkey.

And if you’re getting Could Not Find error, it’s likely because either you haven’t mentioned the extension of the file or entered wrong path. That is, you must type the extension of the file along with path and name in order to delete it.

That’s it!

If you want to get a confirmation prompt before deleting a file, execute the command this way:

Del /P pathtothefile

Ex: Del /P “E:\Office.docx”

And if you’re getting Access Denied, it’s likely because of its read-only attribute.

To perform force deletion of read-only file:

Del /F pathtothefile

Ex: Del /F “E:\Office.docx”

Delete a file from Command Prompt in Windows picture2

To delete all files in a folder

Del /A pathtothefolder

Note that the folder and subfolders will not be deleted.

Delete a file from Command Prompt in Windows picture5

 

How to hide a partition from Command Prompt guide might also interest you.

Filed Under: Windows 10 Tagged: Command Prompt

Related Posts

  • Burn ISO/IMG File From Command Prompt In Windows 10
  • Launch Elevated Command Prompt From Command Prompt
  • How To Run MSI File As Administrator From Command Prompt In Windows
  • How To Make Command Prompt Transparent In Windows 10
  • Pin Admin Command Prompt To Taskbar In Windows 10
  • How To Change Command Prompt Text And Background Color In Windows 7

Leave a Reply

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

Advertisements

Search Into Windows

Recent posts

  • 5 Ways To Go To Desktop In Windows 11
  • How To Show Battery Percentage On Taskbar In Windows 11
  • Fix: AMD Software Adrenalin Edition Not Opening In Windows 11
  • How To Show Year On Windows 11 Taskbar
  • Windows 11 24H2 Is Available Now
  • How To Create 7z & TAR Files In Windows 11 Without Using Additional Apps
  • How To Remove Bell Icon From Taskbar In Windows 11
  • How To Reinstall Windows 11 Without Losing Apps And Files
  • How To Hide/Show Files & Icons On Desktop In Windows 10/11
  • How To Show Hidden Icons On Taskbar In Windows 11

About us

  • About Us
  • Contact Us
  • Privacy Policy

Copyright © 2025 · Into Windows