5

We have a directory that we cannot delete because...

Cannot remove item C:\myDir: The process cannot access the file 'C:\myDir\' because it is being used by another process.

Inside Resource Monitor > CPU > Associated Handles, a search for myDir shows that cmd.exe is using our directory.

Inside Process Hacker, running as administrator, our attempts to terminate cmd.exe are met with this:

Unable to terminate cmd.exe (PID 4656): An attempt was made to access an exiting process.

Beyond restarting the computer, how else can we kill this process and thereby delete or rename our directory?

user 99572 is fine
  • 3,397
  • 3
  • 30
  • 43
Shaun Luttin
  • 2,231
  • 8
  • 41
  • 53
  • You could try [IObit Unlocker](http://www.iobit.com/en/iobit-unlocker.php) – DavidPostill Feb 21 '16 at 23:41
  • @DavidPostill IObit Unlocker did not work. I tried unlock and delete. Unlocker said, "Status: Unlock & Delete successfully." The directory is still there. Odd. – Shaun Luttin Feb 21 '16 at 23:46
  • 1
    Relevant: [In windows, do file-locks stay after a process was terminated via taskkill?](http://superuser.com/q/918476) – DavidPostill Feb 21 '16 at 23:48
  • 1
    Looks like a restart is required then. – DavidPostill Feb 21 '16 at 23:48
  • 1
    You could also try [LockHunter](http://lockhunter.com/) – DavidPostill Feb 21 '16 at 23:50
  • 2
    Yep; Windows is bugged and won't let the process finish exiting so a reboot is the only way to get rid of it. – psusi Feb 21 '16 at 23:54
  • try deleting in safe-mode. – Sanny Feb 23 '16 at 05:35
  • The error message you saw, "An attempt was made to access an exiting process", is the MessageText for the MessageId `STATUS_PROCESS_IS_TERMINATING`, which is NTSTATUS 0xC000010A. All this is according to the "ntstatus.h" header file, which is included in the Windows SDK. – unforgettableidSupportsMonica Mar 20 '17 at 12:37
  • I don't believe that this is a duplicate of the other question of which it is marked as a duplicate. They are different error messages and caused by different things. What tipped me off was that you were using Process Hacker (which is also what I was having a problem with). I closed and re-opened process hacker and the process had closed. So quite possibly it's worth doing that first. It's not the first time it had happened on my server which had a program running and process hacker running for at least a few months. – Matt Vukomanovic Aug 24 '19 at 16:53

1 Answers1

2

It must be an unkillable process. Try a Google search for [ unkillable process ], or check out the thread "How can I kill an unkillable process?" and the solutions mentioned there. Or, as you mentioned, you could restart the machine.

  • In my question a duplicate of the answer to which you referred me? – Shaun Luttin Mar 02 '17 at 01:02
  • 1
    Your question is indeed a duplicate of the unkillable-process question. But Jeff Atwood [writes](https://stackoverflow.blog/2010/11/16/dr-strangedupe-or-how-i-learned-to-stop-worrying-and-love-duplication/) on the official Stack Exchange blog that some duplication is good, and I agree. – unforgettableidSupportsMonica Mar 02 '17 at 01:09