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

后端 未结 5 1844
离开以前
离开以前 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:16

    You can use the short name of the file which has spaces in its name.

    file = 'C:\\Exe\\FirstV~1\\filename.exe'
    os.system(file)
    

提交回复
热议问题