简体   繁体   中英

How to execute a .exe file from python file

I am trying to open google.com with Internet Explorer. This is my program:

import subprocess

arg = ['runas', '/user:Administrator',
        "C:\Program Files (x86)\Internet Explorer\iexplore.exe", "www.google.com"]
subprocess.call(arg)

I saved this file as shortform.py and executed it. The program worked but it doesn't show any output. How can I do this?

Use this:

import subprocess

arg = ['runas', '/user:Administrator', "C:\Program Files (x86)\Internet Explorer\iexplore.exe www.google.com"]
subprocess.call(arg)

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