Introduction
If you’ve ever tried to delete a file and received a message that says the file is in use, you’re not alone. Windows can be very particular about which files it allows users to delete for various reasons, but one of the most common is Windows claiming that the file is in use by some program or process. This article will go over some steps you can take to delete the file and some potential workarounds if those steps don’t work.
The reasons why you might receive a “can’t delete file” message in Windows
There are several reasons why you might receive a “can’t delete file” message in Windows. One reason is that the file is open and in use by another program. Another reason could be that the file is corrupt or infected with a virus. In some cases, you may not have permission to delete the file, or the file may be set to “read-only.” This article will focus on the situation where attempting to delete a file results in a message that the file can’t be deleted because it’s in use by a program or process.
Ways to delete a file that Windows says is in use
The following steps are presented in order, starting with the easiest / obvious and wrapping up with what is hopefully the “all else fails” approach:
Close the program that is using the file
When you try to delete a file in Windows and get an error message that another program is using the file, you should close the program using the file. This assumes that it’s evident which program is using the file, i.e., if the file you are trying to delete is a Microsoft Word document and Word is currently running. Closing Word may allow you to delete the file, even if you were not editing it. To close a program in Windows, right-click on its icon in the taskbar and select “close window.” If you can’t see the program’s name in the taskbar, press Alt+Tab to switch to it, then select “Close” or “Quit” from the program’s File menu.
Check the process list
Windows operating systems use the process list to track which programs are currently running. If you try to delete a file that’s been locked by an application listed in the process list, you’ll get an error message saying the file is in use. If closing the program as explained above does not work, you can use the Task Manager to kill running applications in the Processes list.
Open the Task Manager by pressing Ctrl+Alt+Delete and clicking on Task Manager to see the list. The process list will be shown in the Processes tab. (If you’re using Windows 10, go to Start and type task manager. Click on Task Manager when it appears in the results.)
To close a program, right-click on its name in the process list and select End Task. If you are unsure which program might be using the file, try closing all of the programs listed under Apps in the Processes tab (be sure to save any open files first), then try deleting the file again.
Use the Resource Monitor
If using the Task Manager did not solve the issue, or if you prefer not to terminate all running applications, you can instead use the Resource Monitor to locate the specific program that has locked the file. To delete the file, you’ll need to find the handle for the file and close it.
To get to the Resource Monitor, click on the Taskbar search box and type “Resource Monitor.” Go to the CPU tab. Use the search box on the “Associated Handles” to type the name of the file you are trying to delete (typing just part of the name is ok) and press Enter. Find your file in the Handle Name column, right-click on it, and choose “End Process.” Try deleting your file again.
Use Process Explorer
If using the Resource Monitor did not solve the issue, you can try Process Explorer to determine which program has locked the file. Once you know which program is using the file, you can close that program and then delete the file. Even though Microsoft owns it, Process Explorer is not installed in Windows by default, so you need to get it from Microsoft’s website.
To use Process Explorer, download it from Microsoft, unzip the archive that is saved to your computer, and double-click procexp.exe to run it. Click the “Find” menu and select “Find a Handle or DLL.” Type the name of the file you are trying to delete into the Search dialog box (typing just part of the name is ok), then click “Search.” Locate your file from the results if more than one match is displayed and click on it. The matching process will be highlighted in the lower half of the main window. Right-click on that and click “Close Handle.” Try deleting your file again.
Force delete the file
If you are still getting an error about the file being in use and you’re positive that is not the case, there are a few ways to force-delete a file, even if Windows says it’s in use.
To force the deletion of a file, you’ll be using the Windows command prompt. You’ll need to know the path to the file to use this method. To find the path to a file in Windows, right-click on the file and select “Properties” from the menu. On the “General” tab of the Properties dialog box, you’ll see “Location.” The file’s path is listed there.
For this example, we’ll assume the file is on your desktop, called “something.txt.” Open the command prompt by pressing the Windows key + R to open the Run dialog box. Type “cmd” and press Enter. In the command prompt window, type the following commands, pressing Enter after each:
cd C:\Users\yourname\Desktop
del /f something.txt
The file should be deleted – you’ll get an error message in the Command prompt window if the operation fails.
Use a third-party file deletion utility
If you’re still having trouble deleting the file, you can try a third-party file deletion utility. These utilities can help you delete files even when another process or program is supposedly using them. One popular option is the File Assassin utility, available as a free download. Another popular tool is Unlocker, which adds a context menu item that can be accessed by right-clicking on any file.
Conclusion
Windows can be very particular about which files it allows users to delete. This can be frustrating when trying to clear up space on your computer. However, there are ways to get around this. By following the tips in this article, you can learn how to delete files that are in use and clear up some space on your computer. We hope that this article has been helpful. Happy computing!