> Is it possible in WSH, to detect if a file is in use (dll's)?
> Can this be checked, using wildcards?
> Is it possible to break the lock in WSH?
Hi
What do you want to do with the DLL's, upgrade them to newer versions?
--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway
> Hi,
>
> I want to remove them.
> Often when uninstalling s/w, some file/folders are remaining.
> Sometimes these files are in use.
Hi
I think something like this would be the simplest and best from a WSH script:
Delete (or at least try ;-) to delete the file(s) or folder, using error
handling (On Error Resume Next). If the file(s) or folder still is there because
files(s) are locked, put a script in RunOnce in registry that deletes the
file(s) or the folder after a reboot. Offer a reboot to the user. The last thing
the RunOnce script file is doing is to delete itself from the disk.
228930 - How to Replace Currently Locked Files with Inuse.exe
http://support.microsoft.com/default.aspx?kbid=228930
--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
> Stephan van Beek wrote:
> >
> > I want to remove them.
> > Often when uninstalling s/w, some file/folders are remaining.
> > Sometimes these files are in use.
> >
>
> 228930 - How to Replace Currently Locked Files with Inuse.exe
> http://support.microsoft.com/default.aspx?kbid=228930
Hi
I am not so sure you can use this one to remove files...
I *think* if you specify NULL as the destination, it might. The link to the
TechNet article in the KB article is dead so I can't check.
I know that the underlying API mechanism it uses does support queueing a
straight delete for inuse files on reboot..
I think I probably got that backwards...
> Torgeir Bakken (MVP) wrote:
> > "Michael Harris (MVP)" wrote:
> >>
> >> 228930 - How to Replace Currently Locked Files with Inuse.exe
> >> http://support.microsoft.com/default.aspx?kbid=228930
Note that a newer version exists (v1.4):
Inuse.exe: File-In-Use Replace Utility
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/inuse-o.asp
> >
> > I am not so sure you can use this one to remove files...
>
> I *think* if you specify NULL as the destination, it might. The link to the
> TechNet article in the KB article is dead so I can't check.
>
> I know that the underlying API mechanism it uses does support queueing a
> straight delete for inuse files on reboot..
NULL did not work, gave this message "Error: Replacement file doesn't exist"
NUL worked somewhat better:
C:\>C:\tst\inuse.exe NUL C:\tst\b_maint.dll
InUse - version 1.4
-------------------------------------------------------------------
Copyright (c) 1994-1999 Microsoft Corporation. All rights reserved
Windows 2000 detected - WFP is enforced
INUSE is about to replace the following file
Existing: C:\tst\b_maint.dll
Version: 2.2.3.3
Replacement: NUL
No version info available
Do you want to continue?(y/n) y
NUL is replacing --> C:\tst\b_maint.dll
Changes will not take affect until you reboot.
C:\>
BUT PendingFileRenameOperations showed this:
\??\C:\WINNT\TEMP\INU5.tmp
!\??\C:\tst\b_maint.dll
where INU5.tmp was a 0 byte file.
After the reboot b_maint.dll was of course a 0 byte file :-(
So inuse.exe is only applicable to file replacements during an install, but
not file deletions during an uninstall.
Seems a bit of an oversight if you ask me. After all, what goes up, must
come down...
Could you not use a Winint.ini to remove the files when the system reboots?
Mike
Michael Harris (MVP) <mik...@mvps.org> wrote in message
news:ej1FIwkoCHA.2432@TK2MSFTNGP12...
> Sorry if this is a bit of a red herring but:-
>
> Could you not use a Winint.ini to remove the files when the system reboots?
Yes, but wininit.ini only works on Win9x and WinME (where inuse.exe does not
work).