Exe
February 24, 2024

Exe

February 24, 2024

python打开exe和关闭exe

February 24, 2024
Exe, Python

1. 用os.system打开exe # import os os.system(r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe") #但是上述代码块是无法运行的,因为路径中存在空格 #由于这种方式是采用cmd的方式打开的,当路径中存在空格时无法查找到文件,因此先定位到文件夹再打开exe os.chdir(r"C:\Program Files (x86)\Microsoft\Edge\Application") os.system(r"msedge.exe") 2. 用os.startfile打开exe # import os os.startfile(r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe") 3. 利用pid关闭exe # import ...


© 2024 Powered By Hugo,模板:Hugo-book . Contact: tndyx@hotmail.com

本站总访问量 本文总阅读量