import subprocess, shlex mycmd='"C:\\Program Files\\7-Zip\\7z" x "D:\\my archive.7z" -o"D:\\extract folder" -aou' subprocess.run(shlex.split(mycmd))