So the zip command would be (with the command line version of the 7 zip tool). (current (at time of writing) direct link) There is a "command line" version which is probably better suited for this: The client may need their own copy of 7-zip (or winzip or other) to view the contents of the file. NOTE: Adding a password will make the zip file unfriendly when it comes to viewing the file through Windows Explorer.
This will nest your files correctly in the zip file, without extra folder information. Usually what you want with zip functionality.Ī is for "archive". bat file "C:\Program Files\7-Zip\7z.exe" a MySuperCoolZipFile.zip "C:\MyFiles\*.jpg" -pmypassword -r -w"C:\MyFiles\" -mem=AES256 Note: I am going to zip and then unzip a file. Use it like this: cscript //B j_unzip.vbs zip_file_name_goes_here.zip REM MyVar = MsgBox ( strZipFile, 65, "MsgBox Example" Set objTarget = objShell.NameSpace(outFolder) Set objSource = objShell.NameSpace(strZipFile).Items() Set objShell = CreateObject( "Shell.Application" ) WScript.Echo ( "Extracting file " & strFileZIP)
'The folder the contents should be extracted to. SCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".") REM CurDir = WshShell.ExpandEnvironmentStrings("%%cd%%") REM Set WshShell = CreateObject("Wscript.Shell")
#UNZIP ZIP FILE MAC COMMAND LINE HOW TO#
I put an example on my blog on how to unzip a file using a batch file: ' j_unzip.vbs This way it does not require need of third party applications, just the one batch file that does everything. I've done it in the past for numerous tasks. Then pipe out the script from within your batch file and then call it. Firstly, write an unzip utility using vbscript to trigger the native unzip functionality in Windows.