From time to time, there will be times when you can just can't delete the file. In those case, follow the below steps to force delete files in Windows 10.
Generally, in Windows, you can delete a file or folder by simply pressing the Delete button. When deleted, the file is moved to the Recycle Bin. If you've enabled the Storage Sense feature, Windows will automatically clear the Recycle Bin every 30 days or so. Of course, you can also completely skip the Recycle Bin by pressing the Shift + Delete key.
That being said, at times, the target file might be in use and as such, Windows cannot delete the file. This is mainly because the file is locked. If the file is locked with some other process, Windows cannot delete it.
However, the thing is, it is not obvious why or what application or process is blocking the file from being deleted. In those situations, you can execute a single line command to force delete files.
Warning: Before force deleting, make sure that no important data is stored in the file. Additionally, create a backup before deleting the file. Once deleted, you cannot restore the file.
The command to Force Delete Files
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.
1. The first thing you need is the file path. It is very easy to find. Open the file explorer, go to where the file is stored. Next, click on the address bar and you will see the path. Copy it.
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, you need to navigate to the folder where the file is stored. If the file is stored in some other drive, 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.
Note: If the file you are trying to delete is in the C drive, you can skip this step.
4. With the above command, you will be taken to the drive where the file is located. Next, execute the below command while replacing the dummy path with the actual path where the file is located.
Note: If you are unsure, use the
dir command to list all the files and folders in the directory and see if the file you are trying to delete is in the list.
5. Once you are in the folder where the file is located, 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.
That is it. It is that simple to force delete a file in Windows 10. If you need any help or if you are stuck, comment below and I will try to help as much as possible.