Start-Sleep -Seconds 5
$wshell = New-Object -ComObject WScript.Shell
$wshell.SendKeys("^{F4}")
or
#Note This first line is mandatory
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
# Start WinWord (if not already running)
Start-Process -FilePath "explorer.exe"
# Wait for WinWord to open and become active
Start-Sleep -Seconds 3
(New-Object -ComObject "wscript.shell").SendKeys("^{ESC}")
# Activate the WinWord window (adjust the title if necessary)
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
https://stackoverflow.com/questions/19824799/how-can-i-send-ctrl-or-alt-any-other-key
No comments:
Post a Comment