Cannot remove file, used by a program

Hi!

When i run a virus scan and find a virus, sometimes it can’t be removed because a program or process is using the infected file. How do I find out what process is using it so I can kill it and remove the file? I noticed that the is a box that you can check for the program(Avast) to remove the file on system startup but I want to remove it ASAP.

Best Regards
Mattias

Well, you may try things like Process Explorer from SysInternals, but in general, it may not be possible to remove it without restart. The file may be a DLL loaded into all the processes… so you would have to kill all the processes, which you simply can’t do.