Force delete file or folder in Windows 11 or 10

Stefan
Force delete file or folder in Windows 11 or 10

Sometimes you try to delete a file or folder and it doesn't work. You will then receive a message that the file is in use.

There are a number of reasons that a file or folder cannot be deleted, this may be because the file is in use by another process. It also often happens that the file cannot be deleted because it is placed in a location where the logged in user has limited rights.

This may be the case, for example, on a network location, but also on an external medium such as a external hard drive or a USB-stick. This usually concerns a medium that is protected against writing by rights or by a physical button on the medium itself.

So there are some things you should check in advance before you try it force delete file.

  • Check if the file is in use.
  • Check the disk space on your PC and make sure the media is not encrypted.
  • Is the location where the file is a “read-only” location?
  • Is the trash bin full?
  • Is the file in use by malware. Check this with Malwarebytes.

Once you have checked all this, you can try to force delete the file using the commands below. Some technical knowledge required.

Force delete file in Windows 10 or Windows 11

Delete file directly without recycle bin

For starters you can try it file by moving it to the trash to skip. In Windows, a file is first moved to the trash and from there it can be done still be removed. By skipping this step you may be able to delete the file.

Read also
How to use System Restore in Windows 11? This is how!

Click on the file. Then press the SHIFT + DELETE (DEL) button on your keyboard to delete the file immediately.

Close the file first, then delete it

The second way to try to force close a file is to first exit the process with “taskkill” and then delete it.

Click the Start button and search for “Command Prompt”. Right-click on it and click “Run as Administrator”.

Run command prompt as administrator

In the Command Prompt type:

taskkill /f /im bestandsnaam.exe

The process is now forcibly closed. Of course you change “filename.exe” with the file you are trying to close.

taskkill

If it says “SUCCESS: The process “..” with PID … has been terminated”. Then go to the location of the file and try deleting it again.

Force delete file or folder via Command Prompt

You can also add an argument to force delete a file via the “DEL” command. This is how it works.

Click the Start button and search for “Command Prompt”. Right-click on it and click “Run as Administrator”.

Run command prompt as administrator

Navigate to the location via Command Prompt where the file or folder you want to force delete is located.

Force delete file

In the Command Prompt type:

DEL /F /Q /A "pad-naar-bestand\bestandsnaam.exe"

Replace the path and executable. Now check if you can delete the file.

of the

Force delete folder

If you want to delete a folder, enter the following command:

RD /S /Q "map-locatie"

Replace the path. Now check if you can delete the file.

rd

If you have not already tried this, try restarting your PC.

Read also
Open JAR file in Windows 10/11? That is how it works!

I hope this helped you. Thank you for reading!


Problem solved?


Help other people too.
Share this article on a website, forum or via social media.

Join our new computer forum for questions and computer help.
2 comments
Do you have a computer question?

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