If a file is corrupt or in use, it sometimes seems impossible to edit or delete it. However, you can do that using the Command Prompt. In this article, we'll show you how it works.
Files are normally easy to delete, but if a file is in use or if it has become corrupt, Windows may tell you that the file cannot be accessed. You will then not be able to delete or edit the file. Also read: How to unlock locked files.
Task Manager and File Explorer
In most cases, a file in use is already open in a program, so it cannot be edited in any other way until the file is closed. However, sometimes you get a message that the file is in use when it is not open anywhere. In that case, you can use the Command Prompt to rename or delete the file.
Before you get started, though, it's a good idea to check a few things first. Move all other files in the folder and then try to delete the folder containing the file that is supposedly in use. Does this not work? Then open Task Manager to see if Windows Explorer is open. The file may appear to be in use because Windows Explorer displays a thumbnail.
Using Command Prompt
If these two things don't work, you can use the Command Prompt. Open the Command Prompt and type del (to delete) or run (to rename), followed by a space, and drag the file into the Command Prompt window. Then the path with the file name of the file will appear after the command you specified. To rename the file, you have to type a space again and type in the path and new name of the file (including extension).
For example:
ren "D:\My Documents\Recipes.docx" "D:\My Documents\Dutch Recipes.docx"
Or:
del "D:\My Documents\Recipes.docx"
before you get on Enter to actually run the command, make sure Windows Explorer is completely turned off. You do this by going to task management to go and on the tab Processes to search for explorer.exe. Click on it and choose End task. This will make the start menu and taskbar disappear.
Then, in the Command Prompt, press Enter to execute the command.
On the start menu and the taskbar to get back, you have to go back to task management and in the menu File the option New Task Selecting. type explorer in the field and press Enter.