REM State

23 May

7-Zip

An important tool in our command-line arsenal is a good archive extractor. I like 7-zip (downloads) for many reasons — it can handle a wide variety of files, it has good shell integration, it’s namesake compression algorithm is pretty good (if somewhat esoteric in the Real World), it comes with a command-line front-end, and it’s easy to install.

Really, really easy to install, actually. Unlike Microsoft’s own rktools.msi package, the 7z457.msi actually uses the standard property to specify the install directory:


C:\Temp\7-zip>msiexec /qn /i 7z457.msi INSTALLDIR=”D:\Program Files\7-Zip”

However, I’ll go ahead and throw an interesting twist in because this is too easy. Why not handle the proper selection of the x86/x64/ia64 versions of 7-zip?


IF “%PROCESSOR_ARCHITECTURE%”==”x86″ (
SET PACKAGE=”7z457.msi”
)
IF “%PROCESSOR_ARCHITECTURE%”==”AMD64″ (
SET PACKAGE=”7z457-x64.msi”
)
IF “%PROCESSOR_ARCHITECTURE%”==”IA64″ (
SET PACKAGE=”7z457-ia64.msi”
)
IF “%PACKAGE%”==”" (
GOTO :ERROR
)
msiexec /qn /i %PACKAGE% INSTALLDIR=”%~1″
EXIT /b
:ERROR
ECHO ERROR: Unable to determine install package for your architecture.
EXIT /b 1

Slap that into an install.cmd file, and shabam. Now the proper version of 7-zip will be installed to the specified directory, regardless of what type of processor/OS combination you have (though 32-bit and 64-bit Windows are different SKUs — it wouldn’t make much sense to put 64-bit versions on a 32-bit OS disk, but we’ll ignore that for now :).

To reward everyone for slogging through a week of dull necessity installations, we’ll be going over a slightly less-urgent (but still necessary, IMHO) installation on Monday: Firefox 3 RC0. I promise this one will be a lot more interesting than we’ve encountered so far.

Leave a Reply

Comment Preview:

© 2009 REM State | Entries (RSS) and Comments (RSS)

Global Positioning System Gazettewordpress logo