Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Files in use

0 views
Skip to first unread message

Stephan van Beek

unread,
Dec 11, 2002, 10:35:25 AM12/11/02
to
Hi,

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?

Thanks,
Stephan van Beek
Océ NL

vbee.vcf

Torgeir Bakken (MVP)

unread,
Dec 11, 2002, 8:20:46 PM12/11/02
to
Stephan van Beek wrote:

> 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


Stephan van Beek

unread,
Dec 12, 2002, 2:12:46 AM12/12/02
to
Hi,

I want to remove them.
Often when uninstalling s/w, some file/folders are remaining.
Sometimes these files are in use.

Regards,
Stephan

vbee.vcf

Torgeir Bakken (MVP)

unread,
Dec 12, 2002, 5:55:24 AM12/12/02
to
Stephan van Beek wrote:

> 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.

Stephan van Beek

unread,
Dec 12, 2002, 9:29:58 AM12/12/02
to
ok, thanks for your advice.

Regards,
Stephan van Beek

vbee.vcf

Michael Harris (MVP)

unread,
Dec 12, 2002, 3:40:58 PM12/12/02
to
Stephan van Beek wrote:
> Hi,
>
> 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

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US

Torgeir Bakken (MVP)

unread,
Dec 12, 2002, 4:13:56 PM12/12/02
to
"Michael Harris (MVP)" wrote:

> 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...

Michael Harris (MVP)

unread,
Dec 12, 2002, 5:01:59 PM12/12/02
to
Torgeir Bakken (MVP) wrote:
> "Michael Harris (MVP)" wrote:
>
>> 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..

Michael Harris (MVP)

unread,
Dec 12, 2002, 6:00:40 PM12/12/02
to
> I *think* if you specify NULL as the destination, it might.

I think I probably got that backwards...

Torgeir Bakken (MVP)

unread,
Dec 12, 2002, 6:15:03 PM12/12/02
to
"Michael Harris (MVP)" wrote:

> 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 :-(

Michael Harris (MVP)

unread,
Dec 12, 2002, 9:05:16 PM12/12/02
to
> 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...

Mike Smith

unread,
Dec 18, 2002, 3:48:27 PM12/18/02
to
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?

Mike

Michael Harris (MVP) <mik...@mvps.org> wrote in message
news:ej1FIwkoCHA.2432@TK2MSFTNGP12...

Torgeir Bakken (MVP)

unread,
Dec 18, 2002, 4:00:15 PM12/18/02
to
Mike Smith wrote:

> 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).

0 new messages