vmware-server

How to perform keystroke inside powershell?

家住魔仙堡 提交于 2019-11-26 17:38:09
I have ps1 script to grab some information from the vmware cluster environment. In some place of ps1 script requires the ENTER button keystroke. So, How to do that ? -Thanks Adi Inbar If I understand correctly, you want PowerShell to send the ENTER keystroke to some interactive application? $wshell = New-Object -ComObject wscript.shell; $wshell.AppActivate('title of the application window') Sleep 1 $wshell.SendKeys('~') If that interactive application is a PowerShell script, just use whatever is in the title bar of the PowerShell window as the argument to AppActivate (by default, the path to

How to perform keystroke inside powershell?

雨燕双飞 提交于 2019-11-26 06:06:44
问题 I have ps1 script to grab some information from the vmware cluster environment. In some place of ps1 script requires the ENTER button keystroke. So, How to do that ? -Thanks 回答1: If I understand correctly, you want PowerShell to send the ENTER keystroke to some interactive application? $wshell = New-Object -ComObject wscript.shell; $wshell.AppActivate('title of the application window') Sleep 1 $wshell.SendKeys('~') If that interactive application is a PowerShell script, just use whatever is