The file is being used by another process. How to find out which process?

I keep getting this exception in my program. How to find out which process blocked it with either program code or something with windows?

System.IO.IOException : The process cannot access the file 'file.ext' because it is being used by another process.

+7
windows file-access
source share
3 answers

You can use ProcessExplorer to search for a file:

Just run it (perhaps you need to run it with administrator rights), press Ctrl-F and enter the name of the locked file - it will find all open descriptors that match the specified name and tell you which process it belongs to.

+10
source share

You can use a tool like ProcessMon to find out which process is blocking the file.

+2
source share

Take a look at this: http://www.emptyloop.com/unlocker/

I use it all the time, reports which process blocked it and gives you the opportunity to completely unlock it. Useful especially when your image processing applications are debugged and they explode without closing the file properly.

Hope this helps!

Sean

+1
source share

All Articles