File cannot be deleted because it is in use

G

Guest

Guest
Archived from groups: microsoft.public.win2000.general (More info?)

Often, when trying to delete a file, I get an error message telling me that I
cannot delete the file because it is currently in use.

How do I find out what is the name and ID of the process holding an open
handle to the file?

And sometimes you have a process you want to kill, but you get a message
that the process cannot be killed. This is often due to a service that runs,
how do you find out which service the process belongs to?
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.general (More info?)

blacksheep1666 wrote:

> Often, when trying to delete a file, I get an error message telling me that I
> cannot delete the file because it is currently in use.
>
> How do I find out what is the name and ID of the process holding an open
> handle to the file?
>
> And sometimes you have a process you want to kill, but you get a message
> that the process cannot be killed. This is often due to a service that runs,
> how do you find out which service the process belongs to?
Hi,

Download Process Explorer from SysInternals (task manager on
steroids) and select "Find Handle..." under Find (or just use
the keyboard shortcut Ctrl+F). Fill in the file name.

http://www.sysinternals.com



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.general (More info?)

Is there not a dos command for this?
A command to get the process ID of the process with an open handle to the
file.



"blacksheep1666" wrote:

> Often, when trying to delete a file, I get an error message telling me that I
> cannot delete the file because it is currently in use.
>
> How do I find out what is the name and ID of the process holding an open
> handle to the file?
>
> And sometimes you have a process you want to kill, but you get a message
> that the process cannot be killed. This is often due to a service that runs,
> how do you find out which service the process belongs to?
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.general (More info?)

blacksheep1666 wrote:

> Is there not a dos command for this?
> A command to get the process ID of the process with an open
> handle to the file.
Hi,

Sysinternal's Handle.exe is a free command line utility that
can do this:

http://www.sysinternals.com/Utilities/Handle.html

--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
 

jerry-online

Distinguished
Apr 12, 2011
1
0
18,510
Actually all the solution is really simple. If you are getting the error when trying to move or delete files first got to the Organize menu > Folders and search options > View and at the bottom of the list uncheck the Use Sharing Wizard (Recommended) and this should resolve the issue. The issue that cause this most of the time is a Sharing catalog error in the windows registry which locks the files that are being cataloged for sharing even if they are not in a shared folder, this happens mostly on systems with multiple user profiles setup but is not limited to this restriction. Hope this helps some of the people who get this error.