I know the similar questions were asked here a lot, but I'm not completely satisfied with the answers (and even with the questions).
The main goal is compatibility – it should be applicable to widest possible range of Windows machines (including XP, Vista, and Server 2003 – which together still holds around 20% of Windows share) and produced files should be usable on Unix/Mac machines (so standard archiving/compression formats are preferable).
What the options are:
- Creating a batch that implements some zip algorithm. Apparently this is possible – but only with single files and using CERTUTIL for binary processing (some machines does not have CERTUTIL by default and is not possible to be installed on Windows XP Home Edition)
- Using shell.application through WSH. It is the best option according to me. It allows zipping whole directories and is usable on every Windows machine
- Makecab – despite its compression is not so portable its available on every windows machine. Some external programs like 7-Zip are capable to extract .CAB content, but it will be not so convenient when files need to be used on Unix/Mac. And while compressing a single file is pretty straightforward, preserving directory structure requires a little bit more effort.
- Using .NET Framework – not so good option. From .NET 2.0 there is GZipStream, but it allows compression only of single files. .NET 4.5 has Zip capabilities, but it's not supported on Vista and XP. And even more – .NET is not installed by default on XP and Server 2003, but as it is highly probable to have .NET 2.0 up-to 4.0 it's a considerable option.
- PowerShell – as it relies on .NET it has same capabilities. It's not installed by default on XP, Server 2003 and Vista, so I'll skip it.