首页 > 解决方案 > Python Creating a 7zip archive with command line

问题描述

So I am trying to run a command line argument to create a 7zip archive as below:

rc = subprocess.run([path, 'a', 'archive.7z', '-psecret', 'mhe', 'log.log'])

However, all it is doing is opening 7zip and not creating archive.7z as intended.

Any reason why?

标签: pythoncommand-linesubprocess7zip

解决方案


Adding comment as answer in case others come across this:

When you say 'opening 7zip' I imagine you mean the file manager GUI, which means you are hitting the wrong executable. You want path to end in 7z.exe not 7zFM.exe.


推荐阅读