Wednesday 2 May 2012

I'm looking for a C# Script that will find an open file handle in Windows

It's kinda crazy that in Windows 7, when I try to rename a folder I'm not told what process currently has an open handle to that folder (and is preventing the rename)

My current solution is to open SysInternals ProcessExplorer and do a search for that Handle via the folder anme (which is far to many steps and slow).

Now I know that this can be done in C# (via Com Interop) since I did it for Hackmebank (I bet nobody has found the vulnerability that that hack created :)  ).

But before I dig that code and reimplement it in O2, I was wondering if there is already a better solution out there :)