Zipping from command line

  • Thread starter Thread starter josh
  • Start date Start date
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
 
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
 
Back
Top