如何使用python脚本安装MSI? [英] How to install a msi using python script?
问题描述
是否有用于安装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屋!