Thursday, June 30, 2016

George and Zippy


Zippy: Oh Geoffrey! How can I get a silently self extracting exe file ?

Geoffrey: Well Zippy, you could use 7zip which is a free download from http://www.7-zip.org/.

7Zip has an option to create a self extracting exe file.  With the -y command parameter it will silently extract in its current folder location.  It also has great compression !

Zippy: Oh Thank You Geoffrey.

Bungle: But I already have a licensed copy of WinZip installed.  How can I do that with WinZip Geoffrey?

Geoffrey: Well Bungle, with a WinZip self extracting exe file you need to use the command parameters /auto <folder>.  If you use .\ for the folder it will extract in to the current location.

Bungle: Oh Thank You  Geoffrey.

George:  Is there a way to silently unzip a zip file Geoffrey ?

Geoffrey: Well George, there is.  You can use a vbscript to do that, but be careful; if your zip file is large it will take a very long time.

George: Oh Dear.

Geoffrey: If you did want to do it though it would look something like this:

Dim WshShell, strCurDir, cmdint
 

Set WshShell = CreateObject("WScript.Shell")

strCurDir    = WshShell.CurrentDirectory

'The location of the zip file.
ZipFile=strCurDir & "\battest.Zip"

'The folder the contents should be extracted to.
ExtractTo = strCurDir

'Extract the contants of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)

Set fso = Nothing
Set objShell = Nothing


Zippy: Well I'm much cleverer than all of you because I know how to use powershell, so there.

Zippy: (Quietly to Geoffrey) Geoffrey, can powershell create and extract zip files?

Geoffrey: Yes it can Zippy.  Powershell v5 has cmdlets to do it.  Here are the cmdlets and parameters

# Create a zip file with the contents of C:\Stuff\
Compress-Archive -Path C:\Stuff -DestinationPath archive.zip

# Add more files to the zip file
# (Existing files in the zip file with the same name are replaced)
Compress-Archive -Path C:\OtherStuff\*.txt -Update -DestinationPath archive.zip

# Extract the zip file to C:\Destination\
Expand-Archive -Path archive.zip -DestinationPath C:\Destination

Bungle: Geoffrey, Geoffrey, someone's sent me a zip file but my normal zip tool won't open it.  7-zip tells me the compression method is "pkAES-256-Cert Deflate".

Geoffrey: Oh dear, Bungle.  I'm afraid you'll have to probably have find an unzip tool that supports that compression method.  That looks like they might have used PKWare SecureZip to create that file.  You'll need to install that software before you can unzip it.

and in case you don't know who Geoffrey, George, Zippy and Bungle are......
https://www.youtube.com/watch?v=wqZ2RFgkuoA