Batch file to copy files to zip folder
Use the following in a batch file to copy a folder to a zip file.
set FileToZip=C:\MyFiles\SourceFolder set DestinationZip=C:\MyFiles\MyCompressedFolder.zip del "%DestinationZip%" echo Set objArgs = WScript.Arguments > _zipIt.vbs echo InputFolder = objArgs(0) >> _zipIt.vbs echo ZipFile = objArgs(1) >> _zipIt.vbs echo CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" ^& Chr(5) ^& Chr(6) ^& String(18, vbNullChar) >> _zipIt.vbs echo Set objShell = CreateObject("Shell.Application") >> _zipIt.vbs echo Set source = objShell.NameSpace(InputFolder).Items >> _zipIt.vbs echo objShell.NameSpace(ZipFile).CopyHere(source) >> _zipIt.vbs echo wScript.Sleep 2000 >> _zipIt.vbs CScript _zipIt.vbs "%FileToZip%" "%DestinationZip%" @pause