Winzip command line add-in

S

Steve

Is there anyone with experience using the Winzip command line add-in?

I can't get it to create the zip file with a space in the file name.

Using:

RetValue = Shell("C:\winzip\wzzip.exe C:\MyFolder\My ZipFile.Zip
C:\MyOtherFolder\MyFile.mdb")

What is the syntax when you want a space in the zipfile file name?

Thanks!

Steve
 
D

Dan Artuso

Hi,
Enclose the path in qoutes in quotes:
RetValue = Shell("C:\winzip\wzzip.exe" & """C:\MyFolder\My ZipFile.Zip""" &
"C:\MyOtherFolder\MyFile.mdb")

something like that.
I work a lot with Shell and what i do is build the string into variable(s)
instead of putting it directly in the call. That way I can see what my string looks
before I make the call. If you don't do this, it's pretty easy to drive youself
crazy trying to figure out the correct syntax.
Basically, any path with spaces in it must be enclosed in quotes, just
like when you run it from the command line prompt.
 
S

Steve

Dan,

Thank you for responding!

I think you're on the right track - help me to understand what you have shown
me. It looks like you have a double quote enclosed by double quotes at the
beginning and end of C:\MyFolder\My ZipFile.Zip. Is that correct? I interpret
that then as a string enclosed by double quotes. To me then the string enclosed
by double quotes is:
""C:\MyFolder\My ZipFile.Zip""
I don't understand this, can you explain.

Or did you leave out two ampersands and mean it to be:
""" & C:\MyFolder\My ZipFile.Zip & """

Thanks for the help!

Steve
 
B

Bruce M. Thompson

I think you're on the right track - help me to understand what you have shown
me. It looks like you have a double quote enclosed by double quotes at the
beginning and end of C:\MyFolder\My ZipFile.Zip. Is that correct? I interpret
that then as a string enclosed by double quotes. To me then the string enclosed
by double quotes is:
""C:\MyFolder\My ZipFile.Zip""
I don't understand this, can you explain.

To embed a double quote (") in a string, you need to double-up the double quote
character:

"""" is seen in the resulting string as "

"""This is a Quote.""" is seen in the resulting string as "This is a Quote."

:)
 
D

Dan Artuso

Hi Steve,
The easiest way is to start out with the string the way you know it has to look
and then do the concatenation to make it so.

Any path with spaces has to be enclosed in quotes, so if you were to type
this in at the command prompt you would do this:
C:\winzip\wzzip.exe "C:\MyFolder\My ZipFile.Zip" C:\MyOtherFolder\MyFile.mdb
(at least I'm pretty sure that's what it would be. when I build this stuff I always get it working
from the command prompt first, that way I know what the string has to look like)

and that's the end result you want.
Now the way I build these things is one part at a time.
For the above I would have three variable and concatenate them together.

cmdLine = "C:\winzip\wzzip.exe"
arg1 = """C:\MyFolder\My ZipFile.Zip"""
arg2 = "C:\MyOtherFolder\MyFile.mdb"

notice there are two extra quotes on either side of arg1.
In order to get a literal quote you have to place two quotes in your
quoted string.
and..
finalArg = cmdLine & " " & arg1 " " & arg2
Debug.Print finalArg

which should show:
C:\winzip\wzzip.exe "C:\MyFolder\My ZipFile.Zip" C:\MyOtherFolder\MyFile.mdb
in the immediate window
 
P

Peter Doering

Steve,
I think you're on the right track - help me to understand what you have shown
me. It looks like you have a double quote enclosed by double quotes at the
beginning and end of C:\MyFolder\My ZipFile.Zip. Is that correct? I interpret
that then as a string enclosed by double quotes. To me then the string enclosed
by double quotes is:
""C:\MyFolder\My ZipFile.Zip""
I don't understand this, can you explain.
Or did you leave out two ampersands and mean it to be:
""" & C:\MyFolder\My ZipFile.Zip & """

If this application is running on more than one machine you ought to read
the program path for wzzip from the registry:

1. Get fReturnRegKeyValue from
http://www.mvps.org/access/api/api0015.htm

2. Read wzzip folder:
strWZZip = fReturnRegKeyValue(HKEY_LOCAL_MACHINE,
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wzzip.exe", "")
(valid for W2k and WXP)

3. Build a string containing the entire command:
MyString = """" & strWZZip & """" & " " & _
"""C:\MyFolder\My ZipFile.Zip""" & _
" " & """C:\MyOtherFolder\MyFile.mdb"""
RetValue = Shell(MyString)

(Mind the quotes _and_ blanks! Check the result in the immediate pane.)

HTH - Peter
 
S

Steve

<In order to get a literal quote you have to place two quotes in your quoted
string.>

I never needed to do this so didn't know you had to use two quotes. One learns
something every day!

Thanks, Dan!!

Steve
 
S

Steve

Thanks, Peter, for responding!

Yes, my application could run on different machines so I will use what you have
shown me.

Steve
 
T

Tony Toews

Steve said:
<In order to get a literal quote you have to place two quotes in your quoted
string.>

I never needed to do this so didn't know you had to use two quotes. One learns
something every day!

The only way out of that rule I've ever encountered was using Hollerith Format
Specification in Fortran. Mind you that was back in about 1975 I came across that
one. So it's unlikely you'll encounter it any time soon.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
T

Tony Toews

Steve said:
Is there anyone with experience using the Winzip command line add-in?

Alternatively you could try an altnerative to Winzip so as to avoid licensing issues.
At least one of the zip utilities at my website is free and open source. See
Compression DLLs, OCXs, etc at http://www.granite.ab.ca/access/compression.htm

Tony


--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top