user1014825
user1014825

Reputation: 21

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?

Upvotes: 2

Views: 1194

Answers (1)

Rhand
Rhand

Reputation: 897

Use this:

import subprocess

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

Upvotes: 1

Related Questions