开发者

Emulating a Windows shortcut in Python

开发者 https://www.devze.com 2023-03-05 20:09 出处:网络
This is probably a fairly simple question, but I have gone thoroughly overwhelmed trying to figure it out.

This is probably a fairly simple question, but I have gone thoroughly overwhelmed trying to figure it out.

I want to start another program in Windows from Python 2.6. I have the "comm开发者_StackOverflow社区and-line argument" figured out so that if I create shortcut and double-click on it the other program opens, does what it needs to, and then closes.

I started with the subprocess library, but that seemed not to work. I got overwhelmed looking at all of the different versions of "popen"

How do I run in an external program from Python like I had double-clicked on a shortcut?


Something like below maybe?

import os
os.system("notepad")

Or:

from subprocess import call
call(["notepad"])

The below question has some excellent answers:

Calling an external command in Python

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号