简体   繁体   中英

How to Download the .exe file from the server and Install it

Hi Everyone I have a server in which I update the .exe files I want to search the specific link for exe files and download it and install it using python. I use this code but how to install the .exe file. and is this logic is correct. because it run without any error. but it did't show the output.

import urllib2


filepath = urllib2.urlopen('http://i3.ytimg.com/vi/J---aiyznGQ/')
file_name = ''
for i in filepath:
    file_name = i
completepath = filepath+file_name
datatowrite = completepath.read()

with open('/Users/scott/Downloads/cat2.jpg', 'wb') as f:
    f.write(datatowrite)

To install the exe file, all you have to do is to run it.

import os
current_dir = r"C:\Downloads"
subprocess.Popen(os.path.join(current_dir,"file.exe"))

You'll also need to run the command prompt as administrator.

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