Deleting files from a computer is an easy procedure, but some files may make the process more difficult than it needs to be. The file may be locked and cannot be deleted because it is being used by a program, the Windows operating system, or for another reason.
When you try to delete a file, you might encounter an error message indicating that the program is using the file. You may not make any changes to this file, including deletion.

When a file is classified as being used by Windows, it is usually still opened by another process, which may be changing it. In many cases, Windows even redirects you directly to the program in question in the error message allowing you to close it and try again.
When a file is opened by another application or process, Windows puts the file in a locked state, and you can’t delete, change, or move it to another location. Usually, once a file is no longer in use, the app will unlock it automatically, but that’s not always the case.
Sometimes, the file doesn’t open successfully even though you try to take any action. You will see a warning that the operation could not be completed because it was opened by another program. When it’s locked, Windows still allows other users or processes to access it at any time.
When a file or folder is locked, Windows prevents users from writing, deleting, or modifying existing content. This tutorial will show you how to delete locked files and folders with various methods.
How to Delete Locked Folders and Files in Windows
If you need to delete a locked file, here are some methods you can use to unlock it.
- Close all programs or applications.
- End Application via Task Manager
- Restart your computer.
- Force Delete Used Files via Command Prompt.
- Remove it with a third-party app.
1] Close all programs or applications
The first and easiest way you can do this is to close all open apps. It may be locked and can’t be deleted because the file is still in use by the app you’re currently using.
2] End Application via Task Manager
If you’ve closed all apps and you still can’t delete them, it may be because Windows Explorer is accessing those files. Or when you close apps, they won’t close, you can force them to close by using Task Manager.
To open Task Manager, right-click on the Windows system tray and select the “Task Manager” option. Alternatively, you can use keyboard shortcuts by using keys (CTRL + SHIFT + ESC).

Now, you will see a list of running applications. Then, select and right-click on the app that’s causing the file to lock and select the “End Task” option to force close the app.
You can move all other files in the folder to a temporary folder and then delete the folder that contains the files that cannot be moved, but if this still does not work, try closing Windows Explorer or File Explorer.
If you suspect the cause is “Windows Explorer“, this happens quite often. Select it and right-click, then select the “Restart” option. This is because Explorer is also responsible for the start menu and taskbar. And if you select “End Task”, you need to restart Explorer by clicking the “Run new task” button, then type “explorer.exe” and press Enter.