The process of deleting a file in Windows is simple and straightforward. You need to select a file and then press delete or right-click on the file and select Delete to remove the file. you may also use theShift + Delshortcut to force Windows to delete the file without sending it to the Recycle bin.

However, there are some situations where you can’t delete a file at all, and the usual methods will result in some error messages. In such cases, you need to rely on the command-line interfaces to force the deletion or resolve the root of the problem causing such issues.

cmd-force-delete-file

Through Command Line Interface

You can also use the command-line interface tools likeCommand Prompt and PowerShellto forcefully delete a file in Windows.

However, the commands can’t remove hidden or read-only files on their own, so you need to use the force parameters (/f or -force) alongside in such cases.

powershell-force-delete-file

On PowerShell

By Replacing the File

Another way you can forcefully delete a file is by replacing the file. This way, you can delete some files that you couldn’t by using the above methods. Also, keep in mind that the file won’t go to the Recycle bin as well.

By Booting into Safe Mode

If some application is currently using or holding a file, trying to delete the file results in an error message that says, “The action can’t be completed because the file is open in another program.”

You can try looking for the application that is using the files, close it orend it from the Task Managerand then delete the file. If you don’t know which app it is, restart your PC and delete the file.

replace-the-file-in-the-destination

But if the application is a startup process, restarting may not make the process release its hold on the file. You will need toboot in safe modeto be able to remove the file in this scenario.

Modifying Permissions

you’re able to only delete a file if your current user account or user group has full ACL permissions for the file. If not, you’ll get an error message like “You need permission to perform this action.”

You need to change the security settings to be able to delete the file.

restart-button-in-startup-settings-in-windows-re

Using Robocopy to Mirror an Empty Folder

In some rare cases, you may get files that are not being used by another process but are particularly difficult to remove. For instance, if somehow a filename contains a space at the end, Windows will show the file but treat it as if it’s not there. There are also other scenarios where the same happens.

This file won’t have any security information, and you can’t modify or delete it. If you try to do so, you’ll get the error message: “Could not find this item.”

security-tab-advanced

The easiest way to forcefully delete the file in such cases is tomake it the only file inside a folder and then mirror an empty folder to this one.

Note: If you encounter any error messages, such as0x80070570: The file or directory is corrupted and unreadable, it represents the drive sectors containing the file is corrupted. you’re able to tryrunning chkdskbefore attempting to delete the file in such cases.

change-owner-administrators-check-names

full-control-allow-permission

robocopy-mirror-empty-folder