How to Delete Locked Files in Windows 11/10 via CMD - The Legend of Hanuman

How to Delete Locked Files in Windows 11/10 via CMD


Sometimes, while deleting a file in Windows, we encounter an annoying dialog box indicating that the file is locked or we are not allowed to perform such action. In such cases, we need to use the Command Prompt.

The good thing about using Command Prompt is that you won’t need to spend money purchasing premium file & folder remover. Command Prompt is a built-in feature of Windows that works pretty well.

With the command prompt, you can delete any file or folder on the Windows 10 operating system. Let’s check out.

1. First of all, open the Windows Search box.

open the Windows Search boxopen the Windows Search box

2. On the Windows Search box, search for CMD.

search for 'CMD'search for 'CMD'

3. Right-click on the CMD and select the option Run as administrator.

select the option 'Run as administrator'select the option 'Run as administrator'

4. Now, you need to navigate to the folder where the file is stored.

Find file path in Windows: Right Click > Properties > Details

find file pathfind file path detailsdetails

To navigate the folder, use the command:

cd folderpath

Execute the commandExecute the command

Note: Replace ‘folderpath’ with the actual path where the file is stored. For example, cd C:\Users\techviral\desktop

5. After navigating to the folder, you need to execute the delete command. Simply, execute the command given below.

del /f /s 

Execute the commandExecute the command

Note: Replace the with the file’s actual name. Also, put the extension of the file type. For example, del /f /s notepad.txt

6. Now, on the Command prompt, type Y and press the Enter button.

Deleted fileDeleted file

This article explains how to delete locked files in Windows via the command prompt. I hope it helped you. Please share it with your friends. If you have any questions, let us know in the comment box below.


Share this content:

I am a passionate blogger with extensive experience in web design. As a seasoned YouTube SEO expert, I have helped numerous creators optimize their content for maximum visibility.

Leave a Comment