是否可以被动安装.EXE但仍使用Powershell显示GUI? [英] Is it possible to passively install an .EXE but still show the GUI using Powershell?
问题描述
标题说的差不多,是否可以使用Powershell被动/静默安装.EXE,但仍然显示安装程序GUI?我希望自动单击下一个,但仍希望GUI显示为某种进度指示器.
Pretty much what the title says, is it possible to passively/silently install an .EXE using Powershell but still have the installer GUI show? I'd want the next's "clicked" automatically but would still like the GUI to be shown as sort of a progress indicator.
推荐答案
UPDATE :有一个适用于Windows Installer的Powershell模块.与处理 Powershell的怪癖相比,它可以更轻松地运行等效于msiexec.exe的命令.
UPDATE: There is a Powershell module for Windows Installer. It can help to run msiexec.exe equivalent commands in easier fashion than to deal with Powershell's quirks.
MSI? :如果这是EXE包装程序中的MSI,则通常可以使用以下方法.如果它只是一个普通的EXE文件,则应重新打包为Painter答复-或在可能的情况下使用正确的开关以静默方式运行它.
MSI?: If this is an MSI inside an EXE wrapper, then the below will generally work. If it is just a normal EXE file you should repackage as Painter answers - or run it silently with the correct switches - if possible.
-
MSI提取 : 重新打包 :最后的方法是使用捕获工具将EXE转换为MSI.
Repackaging: Last resort is to convert EXE to MSI using capture tools.
- 关于重新包装的快速摘要(将setup.exe转换为MSI-更多链接:在底部)
- 如何运行/silent模式下具有已调整设置的安装
- Quick summary on repackaging (convert setup.exe to MSI - more links: at bottom)
- How to run an installation in /silent mode with adjusted settings
建议 :我会根据您的内容建议此命令行(在完成时显示带有模式框的基本UI,并在安装过程中隐藏取消"按钮):
Suggestion: I would suggest this command line based on what you wrote (basic UI with modal box displayed at completion & hide the cancel button during installation):
msiexec.exe /I "setup.msi" /qb+!
带有隐藏的取消按钮的采样进度对话框:
Sample progress dialog with hidden cancel button:
按键 :听起来像您希望整个GUI向导都显示出来,并且自动"地单击了所有按钮?那很难.诸如AutoIt之类的疯狂工具-可以将击键推到应用程序窗口的工具-可以做到,但这与普通的纸牌屋一样可靠.这样的风管胶带方法总是有误差源.
Keystrokes: It sounds like you want the whole GUI wizard to show up with all the buttons "auto-magically" clicked? That is hard. Crazy tools such as AutoIt - the ones that push keystrokes to application windows - could do it, but that is about as reliable as your average house of cards. There are always error sources in such duct-tape approaches.
静音! :我想您知道您可以使用
msiexec.exe
的标准命令行开关来隐藏MSI的整个GUI吗?您可以使用完全无声的GUI或完全像您描述的进度条以及许多其他组合.您甚至可以隐藏取消"按钮.漂亮.Silence!: I assume you know you can suppress the whole GUI for an MSI with standard command line switches for
msiexec.exe
? You can go for completely silent GUI or exactly a progress bar like you describe and many other combinations. You can even hide the cancel button. Nifty.UILevel :MSI支持各种"UILevels" -从完全静音到完全互动,安装的互动程度可能会有所不同.有4个基本级别和各种修饰符"(是否显示完成对话框).这是在实践中对不同UILevel的回答:
UILevel: MSI supports various "UILevels" - the installation can be varying degrees of interactivity from totally silent to fully interactive. There are 4 basic levels and various "modifiers" (show completion dialog or not). Here is an answer on the different UILevels in practice: Uninstall from Control Panel is different from Remove from .msi
示例 :以下是一些示例命令行:
Examples: Here are some further example command lines:
-
完全安静,完全没有GUI :
Totally silent, no GUI at all:
msiexec.exe /i "setup.msi" /qn
-
没有模式对话框和隐藏取消按钮的基本GUI :
Basic GUI with no modal dialog boxes and hidden cancel button:
msiexec.exe /i "setup.msi" /qb-!
-
除了最后显示的模式对话框之外,没有GUI :
No GUI except a modal dialog box displayed at the end:
msiexec.exe /i "setup.msi" /qn+
- Handling Progress Messages Using MsiSetExternalUI (C++ sample code, also on github.com)
- Serverfault answer on external MSI GUI
- Tip: User Interface Levels for MSI Installations
- Uninstall from Control Panel is different from Remove from .msi
- Run MsiExec from PowerShell and get Return Code
- 从提取的设置文件中创建MSI (和<一个href ="https://stackoverflow.com/a/51954050/129130">同一条帖子中的另一个答案)
- 捕获在应用程序安装过程中的所有更改在Windows上
- http://blog.deploymentengineering.com/2004 /12/chriss-rant-about-repackaging.html
- http://www.installsite.org/pages/en/msi /admins.htm
- Create MSI from extracted setup files (and another answer in the same post)
- Capturing all changes during an application install on Windows
- http://blog.deploymentengineering.com/2004/12/chriss-rant-about-repackaging.html
- http://www.installsite.org/pages/en/msi/admins.htm
Note: There are several further combinations depending on how you configure things with the 4 different levels of GUI, the modal dialog at the end or not, and finally hide or show the cancel button.
高级 :除了正常使用msiexec.exe外,您还可以通过MSI Win32 API以编程方式隐藏MSI的整个GUI,而自己处理进度消息.
Advanced: Beyond the normal use of msiexec.exe you can suppress the whole GUI of an MSI programmatically via the MSI Win32 API and instead handle the progress messages yourself.
WiX捆绑包 :这是 WiX工具包的方法a>用于交付自己的捆绑包现代GUI. 高级安装程序和
WiX Bundles: This is the approach the WiX toolkit uses to deliver its own, modern GUI for bundles. Advanced Installer and Installshield and others have similar concepts. The integration with Windows Installer is all based on these API-calls.
链接 :
Links:
重新包装:
这篇关于是否可以被动安装.EXE但仍使用Powershell显示GUI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!