Can you program a powershell script to press next in an install wizard?

纵然是瞬间 提交于 2020-06-29 04:13:10

问题


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).

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?


回答1:


Can you? Probably.

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.

Should you? Probably not.

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



来源:https://stackoverflow.com/questions/52004539/can-you-program-a-powershell-script-to-press-next-in-an-install-wizard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!