WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: keslaa on November 21, 2017, 05:46:24 AM

Title: Running 7zip Commands
Post by: keslaa on November 21, 2017, 05:46:24 AM
I am trying to extract a great number of .ZIP files using 7z.exe. I have set the actual command to be:

runwait(environment("COMSPEC"), "/c C:\Program Files (x86)\7-Zip\7z.exe e %filename%"

The line works within a command window; meaning: I can open CMD, change directories to the location of %filename% and run "C:\Program Files (x86)\7-Zip\7z.exe e %filename%" successfully. However, when I run it within the script, the .ZIP file is not extracted. I see the command window open and close quickly, but can't read what is in the window. What is the easiest way I can pipe or capture the output of the window to see what the error is?
Title: Re: Running 7zip Commands
Post by: keslaa on November 21, 2017, 05:49:21 AM
Oops. "/k" instead of "/c". Got it now. Never mind
Title: Re: Running 7zip Commands
Post by: td on November 21, 2017, 06:43:03 AM
You might want to consider quoting the zip7 path; otherwise, the command shell with try to run something called "Program".

Code (winbatch) Select
runwait(environment("COMSPEC"), '/K "C:\Program Files (x86)\7-Zip\7z.exe" e ':filename)