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

Techbout

Technology Simplified.

  • iOS
  • Windows
  • Mac
  • Internet

Delete Locked File Using Command Prompt in Windows 10/11

By: Sam Patwegar | August 15, 2024

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.

As you will agree, this feature in Windows operating system is useful, as it has been specifically designed to protect Shared Files from being mistakenly deleted.

However, it is not uncommon to find Windows preventing a File/Folder from being deleted, even if the File/Folder was created by a User having full rights or permission to View, Edit and Delete Files.

In such cases, you should be able to delete the Locked File or Folder using Command Prompt with Admin Privileges.

Advertisement

Delete Locked File Using Command Prompt

If you are unable to delete a File or Folder on your computer due to File is Locked error, you can find below the steps to delete Locked File using Command Prompt.

1. Delete File Using Command Prompt

Any File, located anywhere on the computer can be deleted by running Del/FolderPath\FileName.extension Command in the Command Prompt window.

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 Folder Path.

Folder Path

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

3. Next, type CMD or Command in the Search bar > right-click on Command Prompt in the search results and select Run as Administrator option.

Open Command Prompt As Admin

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 will be immediately force deleted and removed from your 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 will be immediately Force Deleted and removed from your computer.

Sam Patwegar

Brings practical experience in technical writing from an engineering background to produce fluff-free, easy-to-follow and well tested troubleshooting guides and informative tech-related articles on this website.

Related
  • Fix: “This app can’t open” Error in Windows
  • Fix: Antimalware Service Executable High CPU Usage
  • How to Disable Pagefile.sys 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
  • Fix: Cast to Device Not Working in Windows 11/10
  • Fix: MacBook Camera Not Working Issue
  • Multiple Ways to Disable Face ID on iPhone

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