A command-line utility for compressing sub-folders in a directory.

Depends upon: Windows, 7-Zip


  1. Create a folder on your computer to place utilities into. For the purpose of this guide, I will use the path: "C:\_DevBin"
  2. Download 7-Zip from and install it. Make a note of the folder path it installs to (by default: "C:\Program Files\7-Zip" or "C:\Program Files (x86)\7-Zip" depending on your system architecture and version downloaded).

ZipSubs code

@echo off
for /f "usebackq tokens=*" %%a in (`dir /b/a:d`) do (
    7z a -r %%~nxa

Open a new notepad window, paste in the sample code and save the document as C:\_DevBin\ZipSubs.bat

Make the tool accessable from anywhere

Once you have a local folder with the ZipSubs file in, open your system's Environment Variables dialog. This can vary from different versions of Windows, so you may need to check online for the exact method.

When you have the Environment Variables dialog open, edit the PATH System Environment Variable, and add to the start:

C:\_DevBin;C:\Program Files\7-Zip;

This will make all binaries and executables in the 7-Zip and _DevBin folders available from any command prompt.

Test out your utility!

Open a new command prompt window and navigate to a folder that contains sub-folders. Type ZipSubs and hit enter, and you should see your folders compressed into zip files!

Download the Utility

Here's one I made earlier - a download containing the code and a quick readme.

Download Download