Back to articles
March 5, 2025

Powershell sendKeys to Java installer

We used this to enable sending keystrokes to a Java-based installer in Windows
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
[Microsoft. VisualBasic.Interaction]::AppActivate($conf.installerMainTitle)

[System.Windows.Forms.SendKeys]::SendWait(%n)
Loading comments...