• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Techbout

Technology Simplified.

  • Windows
  • iPhone
  • Mac
  • Web Services

Delete Locked File Using Command Prompt in Windows

By: Sam Patwegar | Updated: December 3, 2025

In general, a Windows computer is known to come up with “File in Use” or “File is Locked for Editing” error, if any User tries to delete a Shared File that is being used by another User.

This feature in Windows operating is useful, as it has been specifically designed to prevent the possibility of a shared File/Folder on the network being mistakenly deleted.

However, it is not uncommon to find Windows preventing a File/Folder from being deleted, even if the File/Folder is not actually being shared or a User with permission to View, Edit and Delete a Shared File is trying to Delete the File.

Delete Locked File Using Command Prompt

If you are unable to delete a File/Folder on your computer, which you know for sure is not being used by another User; the first step is to find the Path to where this File/Folder is located on the computer.

Advertisement

Once the Location of the File/Folder is determined, it can be deleted by running Del/FilePath\FileName.extension command in the Command Prompt window.

1. Delete Locked File Using Command Prompt

You can follow the steps below to find the Location of the Locked File on your computer and delete the File using Command Prompt.

1. Right-click on the Locked File that you want to delete and select Properties in the drop-down menu.

Open File Properties

2. On the Properties screen, switch to Details tab and note down the Path to the Locked File.

Folder Path

In this case, the Locked File Test.rtf is located at Path C:\Users\Username\Desktop.

3. Next, right-click on the Start button and select Command Prompt (Admin).

Open Command Prompt As Admin

Note: You can also type CMD in Search bar > right-click on Command Prompt and select Run as Administrator option.

4. On the Command Prompt screen, type del FolderPath\FileName.extension and press the Enter key.

Delete File Using Command Prompt

Once the Command is executed properly, the File should be Force Deleted and removed from the computer.

2. Delete Locked Folder Using Command Prompt

Similarly, any Folder located anywhere on the computer can be deleted by running rmdir /s /q FolderPath\FolderName Command.

1. Right-click on the Locked Folder that you want to delete and select Properties option in the drop-down menu.

Open Folder Properties

2. On Properties screen, you will find the Folder path listed next to the Location Entry.

Folder Path Location

3. Next, open Command Prompt as Admin > type rmdir /s /q FolderPath\FolderName and press the Enter Key.

Delete Folder Using Command Prompt

Once the Command is executed, the Folder should be Force Deleted and removed from the computer.

Sam Patwegar

10+ years experience in writing fluff-free troubleshooting guides with just the right and required amount of related information. Equally capable of In-depth technical writing.

Related
  • Change 24-Hour Clock to 12-Hour Format in Windows
  • How to Find the Serial Number of Windows Computer
  • How to Disable Lock Screen in Windows 11/10

Primary Sidebar

Advertisement

Recent Posts

  • Fix: System Tray Icon Missing in Windows 11/10
  • How to Use Internet Explorer in Windows 11
  • Multiple Ways to Disable Face ID on iPhone
  • How to Set Reminders on iPhone
  • How to Hide Text Messages on iPhone

Advertisement

© 2025 Techbout.com · All Rights Reserved
About | Privacy Policy | Terms | Contact
Twitter(X) | Facebook