Zipping from command line

J

josh

Is there any way you can zip a file from the command
line... without buying third party software. I know
windows now comes with the ability to zip and unzip files
(by right clicking on the file in explorer).
thanks
Josh
 
D

David Candy

You just copy them into a zip. But you must use Shell functions not file functions. This extracts a zip
Namespace(0) is the desktop, SrcFolder is the folder name dropped on it.

Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments

Set DestFldr=objShell.NameSpace(0)
Set SrcFldr=objShell.NameSpace(Ag(0))

Set FldrItems=SrcFldr.Items

DestFldr.CopyHere FldrItems, &H214
 

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