I am trying to close a handle to a locked file in Windows, using Sysinternals Handle software (http://technet.microsoft.com/en-us/sysinternals/bb896655).

First I search for opened handle:

handle.exe "C:\Temp"

It issues me the following:

Far.exe pid: 1144 type: File 2E8: C:\Temp

Far.exe pid: 1144 type: File 3A8: C:\Temp

Next I run handle.exe with -c parameter. However, whichever number I enter, it does not do anything. I have tried both: 1144, 2E8, 3A8 and 1144 in hex (478) as the software help says it accepts PID in hexademic. Whatever I enter, it just issues the following:

Handle v3.46
Copyright (C) 1997-2011 Mark Russinovich
Sysinternals - www.sysinternals.com

usage: handle [[-a [-l]] [-u] | [-c <handle> [-y]] | [-s]] [-p <process>|<pid>] [name]
  -a      Dump all handle information.
  -l      Just show pagefile-backed section handles.
  -c      Closes the specified handle (interpreted as a hexadecimal number).
          You must specify the process by its PID.
          WARNING: Closing handles can cause application or system instability.
  -y      Don't prompt for close handle confirmation.
  -s      Print count of each type of handle open.
  -u      Show the owning user name when searching for handles.
  -p      Dump handles belonging to process (partial name accepted).
  name    Search for handles to objects with <name> (fragment accepted).

No arguments will dump all file references.

What am I doing wrong?

link|improve this question

75% accept rate
1  
grawity's answer is actually right there in front of you, in the very text that you quote in your question, next to the -c option. The second sentence. – JdeBP Dec 12 '11 at 21:14
feedback

1 Answer

up vote 1 down vote accepted

It seems that you must also specify the process ID:

handle -c 2e8 -p 1144
link|improve this answer
thanks, it was not obvious! – Alex Dec 12 '11 at 15:58
though, judging on someone's opinion (vote-down), it was :) – Alex Dec 12 '11 at 15:59
feedback

Your Answer

 
or
required, but never shown

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