One of the most frequent issues Windows users face is being unable to delete a file, especially if it’s being used by another program or has been locked by the system. In such cases, you need to force delete the file in order to permanently eliminate it from your system.
Here are the steps to force delete a file on Windows 10 or Windows 11.
Close the program or process that is using the file.
First and foremost, close any program or process using the file. If it’s active, you won’t be able to delete it until its use by that program or process has been ended.
Eliminate Processes with Task Manager
If you are unable to terminate a program or process using standard methods, Task Manager can be used instead. Press Ctrl + Alt + Delete on your keyboard and select Task Manager from the list. In the Processes tab, locate and select the process using your file and click on its “End Task” button to terminate it permanently.
Utilize the Command Prompt
If none of the above methods work, you can try using the command prompt to force delete the file. Open up as an administrator and navigate to where the file resides; then type “del” into the command prompt to eliminate it. For instance, if it’s in “C:\Users\Username\Desktop”, enter this command:
del "C:\Users\Username\Desktop\test.txt"
Use a Third-Party Tool
If the above methods don’t work, you can try using a third-party tool to force delete the file. There are several such programs online such as Unlocker, IObit Unlocker and FileASSASSIN that allow users to delete files that are in use or locked by their system.
Restart Your Computer in Safe Mode
If all other methods fail, try restarting your computer in Safe Mode and attempting to delete the file. In Safe Mode, only essential programs and services are loaded – sometimes this allows for successful deletion of a file. To restart in Safe Mode, follow these steps:
- To open the Run dialog box on your keyboard, press either Windows key + R or enter ‘Run’ directly into your search engine.
- Type “msconfig” and press Enter.
- To configure boot behavior on Windows 10, go to the System Configuration window and select Boot from the dropdown list.
- Make sure the “Safe boot” option is selected and select “Minimum” from the dropdown menu.
- Click on both “Apply” and “OK” buttons.
- Restart your computer.
- Once in Safe Mode, attempt to delete the file again.
Check the File’s Attributes
Sometimes, a file’s attributes can prevent its deletion. To check these attributes, right-click on the file and select “Properties”. In the Properties window, go to the General tab and look for the Attributes section. If any “Read-only” or “System” attributes are checked, uncheck them and try deleting again.
Take Control of the File
If you do not have the permissions to delete a file, you can try taking ownership. To do this, right-click on the file and select “Properties”, then navigate to the Security tab, clicking on “Advanced.” On that same screen, click on the Change button next to “Owner.” In Select User or Group window, enter your user name and click on the “Check Names” button before clicking ‘Ok’ to confirm changes.
Utilize the “rd” Command
If a file is located in a folder that contains other files and folders, you may need to use the “rd” (remove directory) command to delete its entirety. To use this command, open up the command prompt as an administrator and navigate to where your file resides. Type “rd” followed by its path – for instance if it were in “C:\Users\Username\Desktop\Test”, you would enter “rd”.
rd "C:\Users\Username\Desktop\Test"
Enable the “Show hidden files, folders, and drives” option.
To delete a hidden file, you may need to enable the “Show hidden files, folders and drives” option in Folder Options window. To do this, navigate to the “View” tab and check off “Show hidden files, folders and drives.”
Check for Viruses
If none of the above methods work, it is possible that the file may have become infected with a virus. In such cases, you should scan your computer with an antivirus program to remove any viruses and then attempt deleting the file once more.