@echo off
setlocal enabledelayedexpansion
set "mainDir=C:\path\to\main"
set "7zPath=C:\Program Files\7-Zip\7z.exe"
for /D %%f in ("%mainDir%\*") do (
echo Processing folder: %%f
set "folderPath=%%f"
set "archiveName=%%~nf"
set "archivePath=%mainDir%\!archiveName!"
echo Creating archive at: !archivePath!.zip
"!7zPath!" a -tzip "!archivePath!.zip" "!folderPath!\*"
)
endlocal