iphonemopa.blogg.se

Zip windows 7
Zip windows 7









Here is an updated version which fixes the "Object required" error reported by pihentagy. My wait loop is based on an answer to a similar issue posted here. One of these issues is that the method returns immediately while the copy process starts in background whereas multiple CopyHere() calls will interfere each other and the ZIP won't be created correctly. Using the CopyHere() method in VBS introduces several issues. I will post something related to WSkids answer as sadly i cannot use the comment function. ' delay until at least items at the top level are availableĭo Until objApp.NameSpace( target ).Items.Count + intSkipped = intSrcItems IntSrcItems = objApp.NameSpace( source ).Items.Count ObjApp.NameSpace( target ).CopyHere objItem ' if this folder is empty, then skip it as it can't compress empty folders Set objFolder = objFSO.GetFolder( objItem.Path )

zip windows 7

' Loop over items within folder and use CopyHere to put them into the zip folderįor Each objItem in objApp.NameSpace( source ).Items Set objApp = CreateObject( "Shell.Application" ) ' this is the header to designate a file as a zip Set zip = objFSO.OpenTextFile(target, 2, vbtrue) Set objFSO = CreateObject("Scripting.FileSystemObject") Here is the vbs code - Set Args = Wscript.Arguments It won't copy empty folders so be careful. Path to script, source folder, zip file to make (include. Usage: in the run box or command line put- "C:\zipper.vbs" "C:\folderToZip\" "C:\mynewzip.zip" The script was originally made for Windows XP, but it also works in Windows 7 圆4 Ultimate - no guarantee's if Windows will keep around the various Shell objects this uses.

zip windows 7

Copy and paste the script into a file with the extension ".vbs". I've combined this script from several different sources to suit my needs better.











Zip windows 7