I need a batch to zip a specific folder inside all the users' profiles.
This is what I have for now, however, I can't think of a way to set the %user% variable to match with each loop.
set ZIPFILE=C:\BKP\%user%.zip
for /d %%a in (
"C:\Users\*"
) do (set "logFolder=%%~fa\AppData\Local\Intuit\QuickBooks\Log\27.0\" & call :woot)
:woot
"c:\Program Files\7-Zip\7z.exe" a %ZIPFILE% "%logFolder%"
I was able to get a "list" of all users using this line
dir /b /ad "C:\Users"
and now I need to find a way to make the loop to change the variable %user% with every loop, for example, the output should be:
7z.exe a C:\BKP\User1.zip C:\Users\User1\AppData\Local\Intuit\QuickBooks\Log\27.0\
7z.exe a C:\BKP\User2.zip C:\Users\User2\AppData\Local\Intuit\QuickBooks\Log\27.0\
Many thanks!