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

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

    Try enclosing it with double quotes.

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

提交回复
热议问题