You're near :)
First, the batch (%%variable) and Windows CMD (%variable) uses different variable naming.
Second, i dont figure out how do you use zip from CMD. This is from Linux users i think. Use built-in zip manipulation is not like easy on Win, and even harder with batch scripting.
But you're lucky anyway. I got (extracted to target folder) zip.exe and cygwin1.dll from the cygwin package (3mb filesize both together) and start play with it right now.
Of course, i use CMD for better/faster testing instead batch. Only remember modify the %varname to %%varname before blame me :P
for /d %d in (*) do zip -r %d %d
Explanation:
for /d ...
that matches any folder inside. Only folder ignoring files. (use for /f to filesmatch)
for /d %d in ...
the %d tells cmd wich name do you wanna assign to your variable. I put d to match widh d (directory meaning).
for /d %d in (*) ...
Very important. That suposses that I CD
to desired folder, or run from. (*)
this will mean all on THIS dir, because we use /d
the files are not processed so no need to set a pattern, even if you can get only some folders if you need. You can use absolute paths. Not sure about issues with relatives from batch.
for /d %d in (*) do zip -r ...
Do ZIP is obvious. (exec zip itself and see the help display to use your custom rules). r- is for recursive, so anyting will be added.
for /d %d in (*) do zip -r %d %d
The first %d is the zip name. You can try with myzip.zip, but if will fail because if you have 2 or more folders the second cannot gave the name of the first and will not try to overwrite without more params. So, we pass %d to both, wich is the current for iteration folder name zipped into a file with the folder name. Is not neccesary to append ".zip" to name.
Is pretty short than i expected when start to play with.