How to find out which process is locking a DLL

Every so often you want to uninstall something and half the times some process has locked a dll file because of a delete or similar operation failed, or just plain explorer.exe that still has the folder open. To figured out which process is causing the problem you can use the TaskList and TaskKill command to solve it.

By using the command line version of Windows Task Manager, instead of launching Task Manager you get interesting features which aren’t accessible in the GUI version. Therefore launch Command Prompt with Run and type “cmd”.

Now to use TaskList in the Command Prompt. It’s the equivalent to the UNIX command ps. Type in “tasklist /m file.dll”. Replace file.dll with the locked dll file you want to research. The /m extension lists all the tasks currently using the given exe/dll name.

Here the file NppShell_04.dll is locked by explorer.exe when trying to uninstall Notepad++. In this case is was because the folder was still opened in an explorer window. You can kill the process by using TaskKill command, or finding it in Windows Task Manager and close the program manually. In this case to kill the explorer.exe type in “taskkill /PID 1424”.

By only typing “tasklist” in the command line you’ll get the simular list you have in Windows Task Manager and ps on Linux. To get an overview of all the combination using TaskList type in “tasklist /?”. You can do the same thing with TaskKill by typing in “taskkill /?”.

Posted in Tips and Tricks, Windows Tagged with: , , , , , , , ,