any input is greatly appreciated. Thanks
DJC
http://rtfm.atrax.co.uk/boards/asp.asp?action=viewPost&postID=295
I still; haven't got around to documenting it fully, though, and I
haven't released the 'full' version yet.
________________________________________
I got bored with my old signature,
so I changed it
Atrax. MVP, IIS
http://rtfm.atrax.co.uk/
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
"Atrax _" <anon...@devdex.com> wrote in message
news:OB4fvXMoCHA.1600@TK2MSFTNGP11...
> I need to add zipping up some files as part of a script. Any known good
> methods out there? The first thing that comes to mind for me is to get rar
> and spawn a command shell to run it... any other, different, easier, better
> ways out there?
Hi
You can use the Run method and shell out and call a command line based zip
program, or you can use an ActiveX component to do this from a script (e.g. the
one Atrax pointed to).
ZipGenius has a command line interface (freeware)
http://www.zipgenius.it/
WinZip Command Line Support Add-On
http://www.winzip.com/wzcline.htm
PowerArchiver has a command line version as well:
http://www.powerarchiver.com
An alternativ to zip is to use cab files instead:
From: Torgeir Bakken (Torgeir.B...@hydro.com)
Subject: Re: create a cab file
Newsgroups: microsoft.public.scripting.jscript
Date: 2002-07-16 20:03:35 PST
http://groups.google.com/groups?selm=3D34DC2F.DD931369%40hydro.com
--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway
>
> An alternativ to zip is to use cab files instead:
>
> From: Torgeir Bakken (Torgeir.B...@hydro.com)
> Subject: Re: create a cab file
> Newsgroups: microsoft.public.scripting.jscript
> Date: 2002-07-16 20:03:35 PST
> http://groups.google.com/groups?selm=3D34DC2F.DD931369%40hydro.com
>
By the way, here's an enhanced form of the catsrvut.dll-based cab file creation.
Torgeir, would you be able to verify that this works on your WIn2KSP2? I've
noticed an oddity with the calls if I try to use a string variable instead of a
string literal; on XP any such call will fail. If I coerce it to a string while
sending, though, it runs fine....
f = Array("C:\WINDOWS\system32\vbscript.dll", "C:\WINDOWS\system32\wshom.ocx",
"C:\WINDOWS\system32\wshext.dll", "C:\WINDOWS\system32\wshcon.dll")
'f = "C:\WINDOWS\system32\vbscript.dll"
MakeCabFile "C:\tmp\Wshcore.cab", f
Sub MakeCabFile( Cabpath, fil)
Dim cab, i
On Error Resume Next
' We turn on error control because different versions of catsrvut.dll
' take different numbers of non-optional arguments.
' An XP version (numbered 2001.12.4414.46) needs 4 arguments;
' A Win2K SP2 version (2000.2.3488.0) takes 3 arguments only
Set cab = CreateObject("MakeCab.MakeCab.1")
' The Methods of catsrvut seem to be finicky about argument types as well
' they tend to throw errors if we don't explicitly coerce the paths to
' strings before sending.
cab.CreateCab CStr(Cabpath), False, False
If Err.Number<>0 Then
If Err.Number = 450 Then
cab.CreateCab CStr( cabpath ), False, False, False
Else
Exit Sub
End If
End If
On Error Goto 0
' following allows simple calls to the function; the files argument
' can be supplied as a single string for one file or as an array for
' multiple files.
' This also
If IsArray(fil) Then
for i = 0 to Ubound(fil)
cab.AddFile CStr( Trim(fil(i)) ), _
CStr( Mid(fil(i), InStrRev(fil(i), "\")+1) )
next
Else
cab.AddFile CStr( fil ), CStr( Mid(fil, InStrRev(fil, "\")+1) )
end if
cab.CloseCab
End Sub
> "Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
> news:3DF6FD57...@hydro.com...
>
> >
> > An alternativ to zip is to use cab files instead:
> >
> > From: Torgeir Bakken (Torgeir.B...@hydro.com)
> > Subject: Re: create a cab file
> > Newsgroups: microsoft.public.scripting.jscript
> > Date: 2002-07-16 20:03:35 PST
> > http://groups.google.com/groups?selm=3D34DC2F.DD931369%40hydro.com
> >
>
> By the way, here's an enhanced form of the catsrvut.dll-based cab file creation.
> Torgeir, would you be able to verify that this works on your WIn2KSP2? I've
> noticed an oddity with the calls if I try to use a string variable instead of a
> string literal; on XP any such call will fail. If I coerce it to a string while
> sending, though, it runs fine....
Your script worked very well on my Win2k SP2 :-)
A symptom of a COM method parameter defined as strongly type byref (ByRef As
String in VB-speak). Not very script friendly ;-).
--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--
Please respond in the newsgroup so everyone may benefit.
http://dev.remotenetworktechnology.com
----------
Subscribe to Microsoft's Security Bulletins:
http://www.microsoft.com/technet/security/bulletin/notify.asp
"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:#VGVdBjoCHA.1636@TK2MSFTNGP10...
There's really no guarantee that the typelib (which is created from an *.idl
file which someone authored independent of the source/executable) is
correct. Don't you have a gizmo for getting typelib info from a running
instance of an object?
--
Please respond in the newsgroup so everyone may benefit.
http://dev.remotenetworktechnology.com
----------
Subscribe to Microsoft's Security Bulletins:
http://www.microsoft.com/technet/security/bulletin/notify.asp
"Michael Harris (MVP)" <mik...@mvps.org> wrote in message
news:#sv9TtkoCHA.704@TK2MSFTNGP09...
Hi,
Can we also do the opposite, eg to read a cab file from WSH?
Purpose: to examine its contents programmatically, be able to answer
questions like "does xyz.cab contain abc.dll" from vbscript
regards,
Prisc.
> "djc" <david.co...@hesstech.com> wrote in message news:<#g5FWFFoCHA.1612@TK2MSFTNGP09>...
> > I need to add zipping up some files as part of a script. Any known good
>
> Can we also do the opposite, eg to read a cab file from WSH?
>
> Purpose: to examine its contents programmatically, be able to answer
> questions like "does xyz.cab contain abc.dll" from vbscript
Hi
This can be done by using Extract.exe from the Microsoft Cabinet SDK (free) or
EclipseCabinet99.ocx from Green Eclipse Software (free)
Download links here:
http://groups.google.com/groups?selm=3D34DC2F.DD931369%40hydro.com
Examples with the two methods:
==================================================
Extract.exe
Parse the output of Extract.exe. Use e.g. output redirection to a file with something like this:
"%comspec% /c extract.exe ... >c:\extract.log"
In a cabinet where abc.dll exists:
C:\>EXTRACT.EXE /D C:\test\Sample.cab abc.dll
Microsoft (R) Diamond Extraction Tool - Version (32) 1.00.0601 (03/18/97)
Copyright (c) Microsoft Corp 1994-1997. All rights reserved.
Cabinet Sample.cab
10-14-2001 1:22:00a A--- 297 abc.dll
1 File 997 bytes
In a cabinet where abc.dll does not exists:
C:\>EXTRACT.EXE /D C:\test\Sample.cab abc.dll
Microsoft (R) Diamond Extraction Tool - Version (32) 1.00.0601 (03/18/97)
Copyright (c) Microsoft Corp 1994-1997. All rights reserved.
Cabinet Sample.cab
No matching files.
==================================================
EclipseCabinet99.ocx
' File to check
sFile = "abc.dll"
' Cabfile
sCabFile = "C:\test\Sample.cab"
Set oExtract = CreateObject("EclipseCabinet99.ecExtract")
oExtract.Filename = sCabFile
On Error Resume Next
sReturn = oExtract.Files.ItemByName(sFile)
If Err.Number <> 0 Then
WScript.Echo "File " & sFile & " does not exist in the cab file " & sCabFile
Else
WScript.Echo "File " & sFile & " does exist in the cab file " & sCabFile
End If
On Error Goto 0
Prisc.
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message news:<3E173AA7...@hydro.com>...
> you are right, thank you!
> However I am surprised there is no "pure vbscript/COM" way (=without
> third party component or separate exe), as cabinets seem to be a deep
> basic feature of windows: setup programs, also from Microsoft,
> downloaded components in Internet Explorer, SQL Server analysis
> services backup etc are relying on them. Having to expand a cabinet
> file to check its contents seems like using a cannon to hit a fly, is
> it not?
Note that none of the two methods I supplied expands the cabinet file to check if a file exists in it...
E.g. EXTRACT.EXE /D will only display files, not extract them.