I have a problem about compressing a directory or a file in a batch file. HOw can I do this, Can anybody help me about this?
Thank you
There is a good solution to a similar question on a Post on SuperUser, I have copy pasted it below.
CScript zip.vbs C:\test3 C:\someArchive.zip
Where zip.vbs contains the following
'Get command-line arguments.
Set objArgs = WScript.Arguments
InputFolder = objArgs(0)
ZipFile = objArgs(1)
'Create empty ZIP file.
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set objShell = CreateObject("Shell.Application")
Set source = objShell.NameSpace(InputFolder).Items
objShell.NameSpace(ZipFile).CopyHere(source)
'Required!
wScript.Sleep 2000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With