Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I currently use OpenedFilesView for control file handle but it is windows based. i want console application for build automation process. i want something like following code

unlockfile file.txt
share|improve this question
add comment

5 Answers

up vote 3 down vote accepted

My tool of choice for this scenario is LockHunter.

It also sports a command-line interface in addition to a GUI. It works on Windows 7 x68 and x64 editions.

http://lockhunter.com/manual.htm

Good luck!

share|improve this answer
add comment

To complement the answer about handle.exe.

Sysinternals Process Explorer features GUI with the same functionality: search for handle by pattern, list process handles, close any of them.

share|improve this answer
1  
I already had this installed, so this tip saved me from downloading extra things. Thanks! –  DOOManiac Feb 7 at 19:50
add comment

Definitely, LockHunter is the best program for this. It's a really powerfull and easy to use program.

http://lockhunter.com/index.htm

share|improve this answer
add comment

The Microsoft/Sysinternals tool Handle.exe tool can unlock files:

handle.exe -c 0x38 -p 1234

You will probably want to automate first running the following to find any usages of app.exe

handle.exe \Path\to\app.exe

You would then need to interpret the results to get the handle id and process id to be passed into the first command.

Do be warned though, closing handles behind application's back is likely to lead to instability in the application that had the handle open.

share|improve this answer
1  
IMHO , handle.exe able to close file by handle only but i want close file by filename –  MajidTaheri May 17 '12 at 18:22
add comment

I've tried a lot of tools for this task. In my opinion Sysinternals 'handle.exe' is the best. It's simple, easy to use and doesn't come with any ads.

share|improve this answer
1  
This does not add anything to the answers from two years ago. –  ChrisInEdmonton Apr 28 at 14:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.