os.system to invoke an exe which lies in a dir whose name contains whitespace

后端 未结 5 1859
离开以前
离开以前 2020-12-15 20:01

My code is simply as follows:

file = \'C:\\\\Exe\\\\First Version\\\\filename.exe\'
os.system(file)

When I run this program, a Windows erro

5条回答
  •  甜味超标
    2020-12-15 20:11

    I used this:

    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))
    

提交回复
热议问题