Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call PKZip through DOS....

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
How would I call the PKZip DOS exe in VB if I would like to compress two files... ie

Location:
c:\Test\test1.txt and text2.txt
Compress To Location:
D:\Test.zip

Thanks....
 
Just use the Shell command.

I'm not sure the way you put parameters on pkzip, but it should be something like:

Shell "C:\directory\pkzip.exe files_to_be_zipped destination_file"

Hope this helps
 
I've been trying to use PKZip as follows...

n = c:\test.zip 'what to call the zip and where it is
'placed...
o = c:\test2.txt 'What to compress and location...

p = Shell("pkzip n o")

... The problem is that I cannot call the variable from in VB and in turn use this to run the PKZip job... is there a way by which I can do this?
 
How about ...

pkz = "c:\pkfiles\pkzip.exe" 'where the executable is

n = "c:\test.zip" 'what to call the zip and where it is
'placed...
o = "c:\test2.txt" 'What to compress and location...

commandline = pkz & " " & n " " & o

p = Shell(commandline)
 
Yep that should do the trick... the way you were doing was wrong since you can't just write the variables inside the string since that way they will be read as simple text...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top