How to find out which process is locking a DLL

I thought this might be useful to people running XP or later. Every so often I need to know what process has locked a DLL because a delete or similar operation failed. In such cases I always turn to tasklist.exe, the command line version of the Windows Task Manager (Ctrl+Shift+Esc). It's not well known but it can be incredibly handy, especially the module switch. Just type: tasklist /m thelocked.dll and it will return all processes that have loaded that DLL!