繁体   English   中英

如何从服务器下载 .exe 文件并安装它

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

大家好我有一个服务器,我在其中更新 .exe 文件我想搜索 exe 文件的特定链接并下载并使用 python 安装它。 我使用此代码但如何安装 .exe 文件。 这个逻辑是否正确。 因为它运行没有任何错误。 但它没有显示输出。

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)

要安装 exe 文件,您所要做的就是运行它。

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

您还需要以管理员身份运行命令提示符。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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