Tech: This File Is Ocupado

Far be it for me to cover a topic that's been smothered and covered more than a batch of hashbrowns at pretty much any Waffle haus in the south, but people keep asking so here goes. In one of my previous nine lives I was a server admin in the Windows world. Although I rarely see this issue crop up on the desktop side, at least knowing about the toolset I'm about to mention will be of some benefit. Now if anyone who is reading this gets aroused by the lackluster piano tune that your laptop belts out every time you login, than not only is this piece too basic for you, but you also need to seek therapy immediately. Now for the rest of us that have to endure Windows servers and their laptop, desktop, netbook equivelant than this may help. The issue I'm going to touch on is a file lock, and the tool I'm gonna fix it with is Process Explorer from Sysinternals.

Now there is a freakish amount of free and not so free tools out there to not only clear file locks, but "tune" your machine, and do all kinds of radical crap that to tell the truth has me feeling filthy right now. In some deep dark corner of my mind I wish I could slap down an Andrew Jackson and have someone fix my errors, tune me up, clean me out, and check my speed. (Coincidentally and randomly, if any single ladies are out there, my speed is just fine.) This tool in particular is and always has been free, which is shocking since they were purchased by Microsoft a few moons ago. To the credit of Microsoft the tools have pretty much remained unfettered, powerful, and priceless.

Sysinternals encompasses a variety of free tools that cover everything from gathering system information to running a real defrag. One of the minds of Sysinternals is a tech named Mark Russinovich who I've been a fan of since my days of setting up Windows NT Backoffice servers. So at least for me, I know these tools and I trust them. (Btw, PSTools was a lifesaver when I was younger.) I could go on and on but I have games to play and pizza to eat so for the purposes of this fix, we're going to use Process Explorer and I'm gonna lay it all out bullet style. However, to show that I'm not above providing some kind of screenshot, I give you one. 

Now before you go crazy nuking files and killing processes it's important that you know what you're doing. For many of the basic stuff, a reboot, killing of explorer.exe, or a venture into safe mode would suffice. This comes in handy when it's some rogue IIS worker process constantly writing to a log file, or some other type of service or application kung fu gripping your file something fierce. I'm just saying be cautious, cause killing the wrong handle could cause some system instability. So consider yourself warned. Good hunting!

Problem: You're trying to delete a file and you get presented with a dialog box that may look something similar to the one pictured below. So what's got it in use and how do I kill it? 

The Fix (DownNDirty):

  1. Download and extract Process Explorer. (If you're like me you have a directory on a drive called C:\tools or something of the like that is in your Path system variable. If so, extract to that then hit Start->Run->Procexp <OK> to get process explorer running.)
  2. Keep in mind where you extracted the Process Explorer components and using your file manager navigate to it and run the executable. (You'll notice you got three files, the exe, a help file, and the EULA. Always helpful to look at those as well, haha who am I kidding.)
  3. You should see a window that looks like the Jesus Christ Superstar of Task Manager, showing all of the system's running processes. Before you get too excited go to the menu and choose: Find->Handle or DLL.
  4. Enter the name of the file you're looking for and run the search. 
  5. Double click the desired result in the list showing the search results. 
  6. You should be returned to the main ProcExp screen where your entry is highlighted, just right click and close handle. 
  7. Now go delete your file you bad ass you. 


Leave a Reply

Your email address will not be published. Required fields are marked *