Skip to content

Instantly share code, notes, and snippets.

@aabir
Last active October 30, 2019 10:24
Show Gist options
  • Save aabir/ccc6e9044a63546bf87c626cf6750067 to your computer and use it in GitHub Desktop.
Save aabir/ccc6e9044a63546bf87c626cf6750067 to your computer and use it in GitHub Desktop.
Create a zip file from batch command using 7zip exclude file or folder.
echo on
for /f "tokens=1,2,3 delims=:. " %%x in ("%time%") do set t=%%x%%y%%z
set time=%t%
set sevenZip="C:\Program Files\7-Zip\7zG.exe"
set outputFld="C:\Users\Shible.Noman\Desktop\ZipperBat\"
set fileToZip="C:\Users\Shible.Noman\Desktop\ZipperBat"
Echo zipping...
%sevenZip% a -tzip %outputFld%"zipped_%t%.zip" -r %fileToZip%"\*.*" -xr!zip.bat -xr!.gitignore
echo Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment