How to force delete a file? [closed]
Asked Answered
M

1

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?

Maronite answered 28/3, 2009 at 16:46 Comment(1)
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 (msdn.microsoft.com/library/cc948910.aspx).Outburst
M
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.

Moloch answered 28/3, 2009 at 16:47 Comment(6)
Wow thanks, thats exactly what i've been looking for.Maronite
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.Gadolinium
Just successfully removed a file locked by dozens of users (via a network share) with Unlocker. Much better tool than procexp in this aspect.Munger
Unlocker is a great tool but it installs a bunch of addons, games and applications that you might not want.Meal
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.Oppidan
For Windows 10 users, the rm command in Bash shell (Windows Subsystem for Linux) will remove a write-protected file after confirmation.Inject

© 2022 - 2024 — McMap. All rights reserved.