您可以对Powershell脚本进行编程以在安装向导中按Next吗? [英] Can you program a powershell script to press next in an install wizard?
问题描述
我想创建一个Powershell脚本来按安装向导中的下一个按钮.
I'd like to create a Powershell script to press the next button in an installation wizard.
我正在对客户端编写的脚本进行故障排除,以帮助他们自动执行软件安装过程.据称,该脚本可以完全安装任何程序(在程序之间进行少量自定义).
I'm troubleshooting a script that a client wrote to help them automate the process of installing software. This script can allegedly fully install any program (with some small amount of customization from program to program).
现在,我已经使它工作到可以启动安装向导的程度,但是随后什么也没有发生.他们的问题只会在安装过程中继续发生,但是我似乎无法弄清楚为什么其中的第一部分不能按next的原因.
Now I've gotten it to work to a point where it launches the install wizard, but then nothing happens. Their problem only happens further down the install process, but I can't seem to figure out why the first part of it being able to press next doesn't work.
如有必要,我可以提供代码.
I can provide code if necessary.
我应该在脚本中寻找哪一行代码可以使脚本按下下一步"和/或继续"按钮?
What line of code I should look for in the script that could make the script push the "next" and/or "continue" buttons?
推荐答案
可以吗?可能.
Powershell可以访问.Net API甚至本机Windows API,因此您可以进行低级操作以枚举安装程序窗口中的窗口,找到标记为"Next"的窗口,然后将一对mouseDown,mouseUp事件发送给按钮.
Powershell has access to .Net API and even native Windows API, so you could go low-level enough to enumerate windows in the installer window, find the window labeled 'Next' and send a pair of mouseDown, mouseUp events to the button.
你应该吗?可能不是.
如评论中所述,任何好的安装程序系统都支持某种静默安装方法.如果我没记错的话,MSI可以记录用户执行的手动步骤并将其存储在响应文件中.然后,您可以在以后的安装程序执行中传递.rsp文件.
As mentioned in comments, any good installer system supports some method of installing silently. MSI, if I recall correctly, has a way of recording manual steps performed by a user and store them in a Response File. Then you may pass the .rsp file in later executions of the installer.
See other answers: How to make better use of msi files
这篇关于您可以对Powershell脚本进行编程以在安装向导中按Next吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!