How to force Windows to delete a file

By Adam Roberts
We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now

Sometimes, for whatever reason, Windows will become convinced a given file is in use by a program and prevent it from being deleted, moved or renamed. This locking up of files is incredibly frustrating, especially when you know the file is not, in fact, being used. Here are two ways to get around that issue.

1. Force delete using Windows

Enter the command prompt (Start-> Run-> Cmd) and enter ‘del /f filename’, where ‘filename’ is the name of the file or files (you can specify multiple files using commas) you want to delete. There are more details on advanced deletion methods here.

2. Use Unlocker

Unlocker is a free program that simplifies the deletion of locked files. It adds a context menu item to Internet Explorer, and can be activated by right-click. It also allows the user to rename or move a locked file.

There you have it, two simple methods for fixing a stubborn issue!

The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
We teamed up with SiteGround
To bring you up to 65% off web hosting, plus free access to the entire SitePoint Premium library (worth $99). Get SiteGround + SitePoint Premium Now
Login or Create Account to Comment
Login Create Account