09stephenb
09stephenb

Reputation: 9806

Adding files to a zip folder using batch

I am making a program using batch that will boost pc performance one of the things it does is edit the registry and just before it does it exports the registry to 5 file using the following code:

@ECHO OFF
reg export HKLM %~dp0hklm.reg > nul
echo hklm
reg export HKCU %~dp0hkcu.reg > nul
echo hkcu
reg export HKCR %~dp0hkcr.reg > nul
echo hkcr
reg export HKU  %~dp0hku.reg > nul
echo hku
reg export HKCC %~dp0hkcc.reg > nul
echo hkcc
reg export HKEY %~dp0hkey.reg > nul
echo hkey
pause

When I do this I get 5 files that add up to 250 MB and this it too big so I put them in a zip file and it added up to 16 MB so its a good idea to compress them. My question is how do I export the 5 files to one zip file instead. Can any one help.

Upvotes: 2

Views: 3043

Answers (2)

npocmaka
npocmaka

Reputation: 57252

you can check the zipjs.bat indtroduced here :

// adds content to a zip file
zipjs.bat addToZip -source C:\some_file -destination C:\myDir\myZip.zip\InzipDir -keep no
zipjs.bat addToZip -source  C:\some_file -destination C:\myDir\myZip.zip

Upvotes: 1

PA.
PA.

Reputation: 29339

Windows 7 does not provide command line access to its native zip functionality. However, it is available to VB or JS. See this superuser question https://superuser.com/questions/110991/can-you-zip-a-file-from-the-command-prompt-using-only-windows-built-in-capabili on how to use it for your purpouses.

Upvotes: 2

Related Questions