The process of deleting a file in Windows is simple and straightforward. You need to select a file and then press delete or right-select 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 may’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.

Through Command Line Interface

you may also utilize the command-line interface tools likeCommand Prompt and PowerShellto forcefully delete a file in Windows.

cmd-force-delete-file

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

By Replacing the File

Another way you may 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.”

powershell-force-delete-file

you may 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.

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 may 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.”

replace-the-file-in-the-destination

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

Using Robocopy to Mirror an Empty Folder

security-tab-advanced

change-owner-administrators-check-names

full-control-allow-permission

robocopy-mirror-empty-folder