简体   繁体   中英

Emulating a Windows shortcut in Python

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 "command-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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM