Author Topic: Running 7zip Commands  (Read 53 times)

keslaa

  • Newbie
  • *
  • Posts: 39
Running 7zip Commands
« 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:

Code: [Select]
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?

keslaa

  • Newbie
  • *
  • Posts: 39
Re: Running 7zip Commands
« Reply #1 on: November 21, 2017, 05:49:21 am »
Oops. "/k" instead of "/c". Got it now. Never mind

td

  • Tech Support
  • *****
  • Posts: 2223
    • WinBatch
Re: Running 7zip Commands
« Reply #2 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
runwait(environment("COMSPEC"), '/K "C:\Program Files (x86)\7-Zip\7z.exe" e ':filename)
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates