簡體   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