views:

5825

answers:

8

Is there a way to unlock Windows files without downloading a utility?

I have a few files on my Windows XP C: drive that are very old and very useless. When I try to delete these files I get the following message:

Cannot delete FILENAME.zip: It is being used by another person or program

Close any programs that might be using the file and try again.

No one is accessing this file. No program is using it currently. Windows has screwed up the file locking mechanism.

Is there a way to delete this file without downloading someone's unlocking utility? I find the sites offering these programs to be a tad sketchy.

How could you force the file to unlock from within a program? I'm competent in Java, Perl, and Ruby, but I haven't seen anything among their libraries that would aid me here.

+1  A: 

If you reboot and the files are still locked, then there is some process on your machine that is still using them. First you should figure out what that process is and determine if the files really aren't used any more or not.

EBGreen
+2  A: 

Use msconfig and start up with everything turned off.

Then try to move / delete the file.

Or you can always boot up in safe mode and delete it.

You do that by hitting f8 when the machine boots up.

mugafuga
+3  A: 

Did you try the commandline command OpenFiles

It is built in (XP and above I believe) and has several arguments that can be passed in.

Brian Schmitt
+11  A: 

I've successfully used Process Explorer to find out which process has the file open. It saves a reboot that may not fix the problem anyway.

Dan Goldstein
One step further with Process Explorer: after using the Find Handle or DLL window, double click one of the search results. It'll select a handle in the main window, which you can right click and close.
David Grant
His original question stated that he didn't want to download a third-party tool.
Brian Schmitt
Well if he thinks the Microsoft site where you would download this from is "Sketchy" in his words (his reason for not wanting to download), then I doubt he would trust any other advice anyway.
EBGreen
This isn't a third party tool. It's published by Microsoft.
Dan Goldstein
File handle feature of Process Explorer is really cool.
Chandan .
+1  A: 

Rebooting to Safe Mode is often a very easy way to do it. When you boot in safe mode, it won't load all the stuff set to run on startup. Press F8 while it's booting to access the boot menu, and choose "safe mode".

MrZebra
+3  A: 

Try downloading "Unlocker". Google it and take my words that it doesn't have any worm/spyware/virus. It is pretty cool utility and works great. Give it a try.

Pradeep
A: 

You don't need any utility. Just use Win32 api to unlock them (simply close the handle)

A: 

The saving title.

amber brint