Extracting a 7-Zip file “silently” - command line option

后端 未结 14 2300
南笙
南笙 2021-02-06 23:19

I want to extract a 7-Zip archive in a Python script. It works fine except that it spits out the extraction details (which is huge in my case).

Is there a way to avoid t

14条回答
  •  逝去的感伤
    2021-02-07 00:15

    7zip does not have an explicit "quiet" or "silent" mode for command line extraction.

    One possibility would be to spawn the child process with popen, so its output will come back to the parent to be processed/displayed (if desired) or else completely ignored (create your popen object with stdout=PIPE and stderr=PIPE to be able to retrieve the output from the child).

    Otherwise Try doing this:

    %COMSPEC% /c "%ProgramFiles%\7-Zip\7z.exe" ...
    

提交回复
热议问题