Site icon WindowsLoop

How to Force Delete Files in Windows 10

Cmd to force delete file - featured

If Windows is blocking you from deleting a file, you can use a single command to force delete the file from the command line. Here’s how.

You can generally delete almost any file or folder by simply pressing the Delete button on the keyboard. When deleted, the file is moved to the Recycle Bin so that you can recover the deleted data when needed. To bypass the Recycle Bin and permanently delete a file, you can use the Shift + Delete keyboard shortcut.

When a file is in use, it cannot be deleted in normal ways. If you try to do that, you can get the “Access Denied: File in use” error message. This is mainly because the file is locked by an application. More often than not, there is no simple way to tell which application is locking the file and blocking you from deleting it. 

In those situations, you can execute a single line command to force delete files.

Important: Before force deleting, make sure that no important data is stored in the file and it is safe to delete. Additionally, create a backup before deleting the file. Once deleted, you cannot restore the file.

Command to Force Delete File

To force delete a file in Windows, we are going to use a single line command. As soon as you execute the command, it will force delete the target file.

Quick steps:

  1. Search for “CMD” in the start menu.
  2. Right-click on the result and select “Run as administrator“.
  3. In the command line window, execute del /s /q "C:\path\to\fileName.ext" command.

Detailed Steps

1. The first thing you need is the file path. Open the file explorer and go to where the file is stored. Next, click on the address bar and copy the path.

2. Now, open the Command Prompt as administrator by searching for “cmd” in the start menu and selecting the “Run as Administrator” option.

3. In the command prompt window, execute the below command while replacing X with the actual drive letter. For example, my file is stored in the E: drive. So, I entered E in the below command.

If the file you are trying to delete is in the C drive, you can skip this step.

X:

4. Once you are in the target drive, execute the below command while replacing the dummy path with the actual path you copied earlier.

cd "E:\Dummy\Folder"

5. This will take you to the folder where the file is located. Now, execute the below command while replacing fileName.ext with the actual file name along with its extension.

In my case, the file I’m trying to delete is a zip file. So, I entered the file name along with its .zip extension.

del /s /q "fileName.ext"

6. If Windows is able to delete the file, you will see a “Deleted File” response.

Wrapping Up

That is it. It is that simple to force delete a file in Windows 10. If you are still receiving errors while deleting the file, it is very probable that Windows is blocking the deletion due to insufficient permissions or some system process is using the target file. If that’s the case, reboot the system and try again.

I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible.

Exit mobile version