如何使用python脚本安装MSI? [英] How to install a msi using python script?

查看:74
本文介绍了如何使用python脚本安装MSI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有用于安装MSI的python脚本?我需要安装msi并运行它而不显示任何对话模式.我在文件夹c:\ user \ documents上有msi,并且我有一个使用python script开发的wxpython GUI.我需要静默安装msi并从GUI运行exe.

Is there any python script to install a msi? I need to install msi and run it without showing any dialogue modal. I have msi on my folder c:\user\documents and i have a wxpython GUI developed using python script.I need to silent install msi and run the exe from the GUI.

推荐答案

简单使用.没有提供任何转换,并且代码是非阻塞的:

simple use. No transforms provided, and code is non-blocking:

import os
os.system('msiexec /i %s /qn' % msi_location)

具有转换,并且代码是非阻塞的:

With transforms, and code is non-blocking:

import os
os.system('msiexec /i %s TRANSFORMS=%s /qn' % (msi_location, transforms_location)

有了转换,并且代码正在阻塞-所以您知道它何时完成:

With transforms, and code is blocking - so you know when it has completed:

import subprocess
subprocess.call('msiexec /i %s TRANSFORMS=%s /qn' % (msi_location, transforms_location), shell=True)

有关TRANSFORMS的更多信息: https://msdn.microsoft.com/zh-CN/library/aa367447%28v=vs.85%29.aspx

For more info on TRANSFORMS: https://msdn.microsoft.com/en-us/library/aa367447%28v=vs.85%29.aspx

这篇关于如何使用python脚本安装MSI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆