How to delete locked files in Windows 10 using Command Prompt

If you are planning to clean your Windows 10 computer to get rid of unwanted files, but what if you come across errors while deleting files? Worry not, we have got an easy solution for such situations.

Sometimes, when you try to delete a file in Windows 10, you may come across an annoying dialog box indicating that the file is locked or you are not allowed to perform the action. In such cases, you can take the help of the Command Prompt.

In this step-by-step guide, we will show you how you can use the built-in Command Promot tool on your Windows computer to delete the locked files.

Windows-10

How to delete locked files in Windows

Step 1: Open the Command Prompt with Administrator privileges on your computer. For this, press the Windows + Alt keys on your keyboard, and from the context menu, select Command Prompt (Admin).

Step 2: Now, go to the directory where the file is located using the CD command.

Step 3: In that directory, enter the following command:

DEL <filename> /F /Q

Make sure that you replace the <filename> with the actual name of the file, along with the extension of the file type.

Step 4: Press the Enter key and the file will be deleted from your computer.

In most cases, the locked file should get deleted using the command prompt. However, if you are still facing issues deleting the file, you may need to use the Windows Recovery mode to perform the task. We will soon cover that in a new guide.