模拟ESC键被powershell击中



我读到它以前不在那里,

但是有没有办法模拟一个"ESC"从powershell脚本按键?

和人按ESC键一样。

查看以下2个资源:

如何在powershell内执行按键?

https://www.jesusninoc.com/11/05/simulate-key-press-by-user-with-sendkeys-and-powershell/

简而言之:

$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('title of the application window')
Sleep 1
$wshell.SendKeys("{ESC}")