How to Force Delete Files & Folders Using CMD in Windows


Force Delete Files & Folders Using CMD in Windows


The command prompt (CMD) in Windows is a very powerful tool. For everyday use, you may never need to use the command prompt. However, if you need to do something more, it is your best option.

Sometimes you may not be able to delete files or folders using the Windows Explorer. This may be due to a virus or some other underlying cause which may be locking the files or folders and preventing their deletion. In such cases, you can use CMD to delete those files or folders.

There are also several free tools (for example IObit Unlocker) that will unlock files and folders and allow you to delete them using the Explorer. Using such applications is an option but if you do not want to install an additional application, you can always use the command prompt to do the job.

Alternatively you can even use the command prompt on windows to delete files which are refusing to be deleted via the windows explorer. However before we proceed ahead, i would only advise you to use this method if you are familiar with the command prompt. If the instructions are not followed properly, you might accidentally delete something else.

While using the command prompt, it is necessary to exercise caution. This is because if you accidentally delete system files, your computer may become inoperable. You may have to reinstall the operating system to rectify the problem. Therefore, it is necessary to be careful by using the command prompt.

Here are instructions to post delete files and folders using CMD in Windows.


Delete a Single File using the Command Prompt on Windows:

Step 1: Run the Command prompt on windows.
(To open Command prompt type “CMD” in the search field in the taskbar & click on “Command Prompt”)

Step 2: Type the following command into the command line and press enter.

DEL /F /Q /A <File Path>
/F parameter stands for force deletion of files
/Q parameter ensures the Forces deletion of read-only files
/A parameter will select only the files with the ready for archiving attribute
Finally replace <File path> with the path of the file or folder.

For example: Type the following command into the command prompt and press enter.
DEL /F /Q /A C:\Users\Lovejeet\Desktop\infected.txt

If the file gets deleted successfully, then you won’t receive any error. 


Delete a Folder using the Command Prompt on Windows:

Step 1: Run the Command prompt on windows.

Step 2: You will need to type the following into the command line.
RD /S /Q <Path of the Folder>
RD stands for Remove Directory
/S deletes all subfolder and files
/Q deletes directories without confirmation

For example: Type the following command into the command prompt and press enter.
RD /S /Q C:\Users\Lovejeet\Desktop\Folder

If the folder gets deleted successfully, then you won’t receive any error.

4 comments:

  1. I am really greatfull to you as you shared this.I am recently developing an app lucky patcher app which is you might be interested to look on it.

    ReplyDelete
  2. I am really greatfull to you as you shared this.I am recently developing an app lucky patcher app which is you might be interested to look on it.

    ReplyDelete
  3. Your article is incredibly useful.Everyday your diary inspire Pine Tree State heaps deal and helped to develop one thing new like I actually have developed a brand new app lucky patcher 2018 this is often great and pleasant.Thanks for the awe-inspiring posts , please keep updated frequently.

    ReplyDelete
  4. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion.
    From the tons of comments on your articles,
    I guess I am not the only one having all the enjoyment here! keep up the good work.best android apk download site

    ReplyDelete

Baidu WiFi Hotspot v5.1.4.59374 | Download | Free Wifi Hotspot software

Baidu WiFi Hotspot v5.1.4.59374 Author: Baidu, Inc. License: Freeware OS: Windows XP/Vista/7/8 (32-Bit/64-Bit) Download Latest Version (5.1...