I would like to be able to create a batch script that will zip up a directory specified in the command. Then I would like to call it info.zip. Any help would be wonderful! Thanks.
Asked
Active
Viewed 114 times
0
-
possible duplicate of [Can Windows' built-in ZIP compression be scripted?](http://stackoverflow.com/questions/30211/can-windows-built-in-zip-compression-be-scripted) – Mark Mar 07 '14 at 04:44
2 Answers
0
you can use 7zip that can be called from command line with lots of parameters. You can find some good examples here

Bruno Deprez
- 418
- 8
- 16
-
Is there any way to do this without having to install any thing? I really don't care if I have to use Visual Basic, or anything. – drcomputer Mar 07 '14 at 04:37
-
Windows doesn't have native ability to do this through the command-line. – 09stephenb Mar 07 '14 at 09:58
-
Having a 7zip deployed on a shared file system is always useful for this type of script. I recommend to deploy it, it will save you a lot of time and can be used by lots of different scripts – Bruno Deprez Mar 09 '14 at 23:00
0
Try this edit ware appropriate.
Dim fso, winShell, MyTarget, MySource, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set winShell = createObject("shell.application")
MyTarget = Wscript.Arguments.Item(0)
MySource = Wscript.Arguments.Item(1)
Wscript.Echo "Adding " & MySource & " to " & MyTarget
'create a new clean zip archive
Set file = fso.CreateTextFile(MyTarget, True)
file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
file.close
winShell.NameSpace(MyTarget).CopyHere winShell.NameSpace(MySource).Items
do until winShell.namespace(MyTarget).items.count = winShell.namespace(MySource).items.count
wscript.sleep 1000
loop
Set winShell = Nothing
Set fso = Nothing

Community
- 1
- 1

09stephenb
- 9,358
- 15
- 53
- 91