1

I am trying to figure out a way to select several files and folders in Windows Explorer and add them to a password protected .zip archive using a batch script, 7zip and a custom context menu item.

Currently I have a .bat file that looks like this:

pushd %~f1
"%programfiles%\7-zip\7z.exe" a Archive.zip  -pPASSWORD %1

(pushd is necessary because I am using a UNC path)

I have added this file to the right click context menu and it can be executed on all filetypes and folders.

My problem is that if I have the %1 at the end of the batch script (see above) it only adds the file I actually right-clicked on (regardless of how many files and folder I have selected), and if I leave out the %1 it adds all files and sub-folders in the current folder, not just those I selected.

Is there any way I could get this batch script to work like the "add to archive..." option of 7Zip (adding only the selected files and folder to an archive and nothing else)?

Thank you very much in advance!

1 Answer 1

0

Try replacing %1 with %* which will add all selected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .