模拟Windows按键的Powershell代码是什么?

问题描述

我试图制作一个.ps1程序来自动刷新边缘中的站点-我也希望它定位窗口。我需要它来模拟按Win + RIGHT,但是找不到Windows键的代码

$wshell.SendKeys('{??????}')

解决方法

与Windows Key的SendKeys一起使用的键绑定是这样的:

# Activating the Windows Key
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait('^{ESC}')
,

就我个人而言,我将使用Autoit powershell模块来完成此任务。如果下载了zip文件,则需要将zip文件中的目录“ install \ AutoitX”解压缩到计算机上的某个位置。当然,一定要取消阻止该zip文件。然后,导入autoit powershell模块,然后您可以按以下代码通过您提到的键发送仿真:

Initialize-AU3
Send-AU3Key -Key "#{RIGHT}" -Mode 0