1

Hi adding file on existing rar file using batch is working but .zip file doesn't support winrar so what is the other way to do this? Thank you.

Here's the code of batch file adding file on existing .rar Add a single file to each rar file in a folder

Community
  • 1
  • 1
ImNotAwesome
  • 79
  • 1
  • 6

1 Answers1

0

Take a look at this and the zipjs.bat :

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

Update

if you want to execute this over all zips in a directory:

@echo off
pushd "C:\Users\userss\Downloads\Folder\"
for %%a in (*zip) do (
  call zipjs.bat addToZip -source "readme.txt" -destination "%%~fa"
)
popd
Community
  • 1
  • 1
npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • @ImNotAwesome you can get the zipjs.bat from the second link and just need to put it in the same directory as the bat which adds the content to the zip. – npocmaka Sep 08 '15 at 11:19
  • Hi thank you for your reply. I did that so the problem is the code. `-destination C:\Users\Userss\Downloads\Folder\*.zip\InzipDir` I'm trying to add a file on every zip on the folder, so is this the error? Thanks – ImNotAwesome Sep 08 '15 at 11:25
  • @ImNotAwesome - to process every zip you'll need for loop e.g. `for %%a in (*.zip) do some command "%%a"` . The `InzipDir` is a direcotry in the zip you neef to be sure that exists. – npocmaka Sep 08 '15 at 11:32
  • `call zipjs.bat for %%a in ("C:\Users\userss\Downloads\Folder\*.zip") do addToZip -source C:\Users\userss\Downloads\Download\readme.txt -destination` – ImNotAwesome Sep 08 '15 at 11:51
  • you're awesome and i'm not. thank you so much. i'm not really used to this. – ImNotAwesome Sep 08 '15 at 16:20