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 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?

share|improve this question
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

2 Answers 2

up vote 3 down vote accepted

It seems that you must also specify the process ID:

handle -c 2e8 -p 1144
share|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

The option syntax has -c between vertical bars which means it is a usage which can be specified on it's own.

To be correct the syntax diagram should be

| -c <handle> [-y] -p <pid> |

which says that when you specify -c you must also specify -p and may specify -y, and that -c requires a handle and -p requires a pid.

share|improve this answer

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.