Usually it's easy to delete files, and it's much more common to delete a file by accident. However, there are some files which can't be deleted: they're in use by an application, they're corrupt or another reason. Here are several ways of deleting or renaming files which are in use.

When a file is classified as "in use" by Windows, it is typically still open by another process, which could be making changes to it. In many cases, Windows even points you directly to the program in question in the error message, allowing you to simply close it and try again. Typically though, this isn't the case. If the file is displayed as "in use" but there's no indication of a program whatsoever, you have two options to proceed: You can either use the handy tool Unlocker, which integrates itself into the Windows UI seamlessly, or delete or rename files over the command prompt without any third party software. This might also be of interest: What to do when Windows Explorer doesn't refresh

However, there are a couple of other things to try first - quick fixes, if you will:

How to delete or rename a file in use: Close Windows Explorer

If you've closed down all applications and you still can't delete a file, it's probably because Windows Explorer is accessing the file, perhaps to display a thumbnail.

You can move all other files in the folder to a temporary folder and then delete the folder that contains the immovable file, but if this still doesn't work, try closing Windows Explorer. To do this, start Task Manager (right-click on the taskbar and choose Task Manager).

How to delete corrupt files in Windows

Now look through the list of running applications for Windows Explorer, right-click on it and choose End Task. You'll then have to restart it, since Explorer is also responsible for the start menu and the task bar. To do that, click File, Run... and type Explorer.exe and press Enter.

How to delete or rename a file in use: Windows Safe Mode

A second option is to restart your PC in safe mode. Press F8 when the computer is starting up until you see the boot menu. Choose Safe Mode and a cut-down Windows will load. You can try deleting the file in Windows Explorer or File Explorer. Here's how to boot into safe mode in Windows 10.

How to delete corrupt files in Windows

How to delete or rename a file in use: Third-party deletion utility

If neither of those works, you can download and install a utility that can clean up troublesome files, including those that can't be deleted. They tend to create a script which runs when Windows boots up at a time before any restrictions are placed on the file preventing it being deleted. They include File Assassin and MoveOnBoot.

Also, as has been mentioned in the comments below, you can try Long Path Tool.

Another method of finding out which program is using particular files is by using the freeware Unlocker. Download the tool and install it. This adds an option in the context menu called “Unlocker” that allows you to get an overview of all the processes that are currently trying to access this file. Choose an operation from the drop-down menu and click on “Unlock all” to close all so-called “Handles” that are blocking access to the file and to apply your operation of choice.

How to delete or rename a file in use: Use the Command Prompt

Yet another method is to use the Command Prompt. You'll find this in your Start menu, or Start Screen. Just search for it, click on it and a black window will open. Or, press the Windows key and R to bring up the Run.. box and type cmd.exe and press Enter.

  1. 1. Type “del” or “ren” into the prompt, depending on whether you wish to delete or rename the file, and hit space once.

  2. 2. Drag and drop the locked file with your mouse into the command prompt. If you wish to rename the file, you need to append the new name for it at the end of the command (with the file extension). This is shown in the image above.

  3. 3. You will need to close the Windows Explorer to release the lock on all files in use (as per our tip above). To do so, first close all Explorer windows and open up Task Manager with the key combination Ctrl-Shift-Esc. Switch to the Processes tab.

  4. 4. Look for the entry explorer.exe, select it and click on End Task. If there are multiple entries called explorer.exe, you must close them as well.

  5. 5. Switch over to your command windows and hit Enter to activate your prepared command. If everything has gone well, your file should be deleted or renamed without any hassle.

  6. 6. To bring your Start menu and taskbar back, click back on Task Manager and choose New Task (Run) from the File menu and type explorer into the empty field. Press Enter to restore the Windows interface.

How to delete or rename a file in use: Change the file extension

Sometimes this is the simplest way to delete a file that refuses to budge using the Delete key. If you have file called birthday.mp3, select it in Windows Explorer, press F2 and change the extension - the .mp3 - to something else such as .txt.

You'll have to enable file extensions first, though, since Windows defaults to hiding extensions for known file types. To show extensions in Windows 8 onwards, click on the View tab and tick the 'File name extensions' box.

In previous versions, including Window s7, search for 'folder options' in the Start menu. Click on it and a window will appear. Scroll down and untick the box for "Hide extensions for known file types" and click OK.