Page 1 of 1

How to run 7Zip via Batch

Posted: 01 Sep 2020 04:26
by YetAnotherUser
Dear all,

I'm working on a small .bat program which should do some small tasks in my testenvironment
One piece should be to zip all logfiles in a specific folder, using the 7Zip application

When I open a command box, walk through the folder (c:\program files\7-zip) and run the following command: 7z.exe a -tzip c:\temp\mylogs.zip c:\testenvironment\logs\*.log everything works absolutely perfect.

When I run my batch which includes this start "" "c:\program files\7-zip\7z.exe a -tzip c:\temp\mylogs.zip c:\testenvironment\logs\*.log" windows come up with an error saying windows cannot find c:\program files\7-zip\7z.exe a -tzip c:\temp\mylogs.zip c:\testenvironment\logs\*.log

Any ideas on how to resolve this ?
Thanks in advance

Re: How to run 7Zip via Batch

Posted: 01 Sep 2020 06:30
by Squashman
by putting quotes around the entire execution of 7zip, you are basically telling the command processor to look for an executable file named the same as everything inside the quotes. Quotes are only needed for the file paths.