Key SendKeys
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
SHIFT +
CONTROL ^
ALT %
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
要记住的一件事是应用程序启动需要一段时间,您可能会在计算器准备好之前发送您的密钥。
尝试类似:
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
Calc
start-sleep -Milliseconds 500
[Microsoft.VisualBasic.Interaction]::AppActivate("Calc")
[System.Windows.Forms.SendKeys]::SendWait("1{ADD}1=")
这应该让你从谷歌得到一个报价:
$IE=new-object -com internetexplorer.application
$IE.navigate2("https://www.google.co.uk/finance?client=ob&q=NASDAQ:MSFT")
$IE.visible=$true