29

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here.

How can i force Windows XP to delete file that is currently being used by some application?

Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
  • This question should be reopened; it was asked as a programming question. The answer provided is fine. Batch scripts can invoke programs. I would recommend the Restart Manager API (https://msdn.microsoft.com/library/cc948910.aspx). –  Feb 17 '18 at 18:00

1 Answers1

34

You have to close that application first. There is no way to delete it, if it's used by some application.

UnLock IT is a neat utility that helps you to take control of any file or folder when it is locked by some application or system. For every locked resource, you get a list of locking processes and can unlock it by terminating those processes. EMCO Unlock IT offers Windows Explorer integration that allows unlocking files and folders by one click in the context menu.

There's also Unlocker (not recommended, see Warning below), which is a free tool which helps locate any file locking handles running, and give you the option to turn it off. Then you can go ahead and do anything you want with those files.

Warning: The installer includes a lot of undesirable stuff. You're almost certainly better off with UnLock IT.

Draken
  • 3,134
  • 13
  • 34
  • 54
Konstantin Tarkus
  • 37,618
  • 14
  • 135
  • 121
  • 1
    Wow thanks, thats exactly what i've been looking for. – Jakub Arnold Mar 28 '09 at 16:55
  • 2
    Just a word of caution: Processes locking a file often have a good reason for it. If you close the handle forcibly the program is free to crash. – Joey Apr 01 '11 at 12:44
  • Just successfully removed a file locked by dozens of users (via a network share) with Unlocker. Much better tool than procexp in this aspect. – kubanczyk Sep 29 '13 at 16:40
  • 6
    Unlocker is a great tool but it installs a bunch of addons, games and applications that you might not want. – special0ne Jan 15 '14 at 22:18
  • UnLock IT worked for me. I was unable to download Unlocker - Chrome completely blocks all attempts to do so, labeling it as malware. I've edited the answer, including a warning label next to Unlocker and giving UnLock IT more prominence by moving it up. – ArtOfWarfare Feb 24 '16 at 19:49
  • For Windows 10 users, the rm command in Bash shell (Windows Subsystem for Linux) will remove a write-protected file after confirmation. – Will Jan 23 '17 at 23:26