Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 4000 "!这时把光标移到另外一个窗口
WshShell.AppActivate "无标题 - 记事本"
WScript.Sleep 500
WshShell.SendKeys"aadsfadfadbsvzxcv"
改成这样就可以了
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 4000
WshShell.AppActivate "无标题 - 记事本"
WScript.Sleep 500
WshShell.SendKeys"aadsfadfadbsvzxcv"