我试图使一个.ps1程序自动刷新边缘的网站-我也希望它的位置窗口。我需要它来模拟按下Win+RIGHT,但我找不到windows键的代码。
$wshell.SendKeys('{??????}')
hsvhsicv1#
就我个人而言,如果我是你,我会使用Autoit powershell模块来完成这项任务。如果您下载了zip文件,您需要将zip文件中的目录“install\AutoitX”解压缩到计算机上的某个位置。当然,在此之前一定要先解除对zip文件的阻止。然后,导入autoit powershell模块,您可以使用以下代码发送emulate按下您提到的键:
Initialize-AU3 Send-AU3Key -Key "#{RIGHT}" -Mode 0
csga3l582#
用于Windows密钥的SendKeys的密钥绑定如下:
# Activating the Windows Key Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.SendKeys]::SendWait('^{ESC}')
gkl3eglg3#
AutoIt响应按预期工作,因为SendKeys能够按Windows键,但不能按windowskey +另一个键。下载AutoIt zip并将AutoItX文件夹保存到永久位置:https://www.autoitscript.com/site/autoit/downloads/按windowskey + e的示例代码:
AutoItX
Import-Module "C:\Path\AutoItX\AutoItX.psd1" Initialize-AU3 Send-AU3Key -Key "{LWINDOWN}e{LWINUP}" -Mode 0
(我会把这个作为对现有AutoIt答案的评论,但我还没有50的声誉,对不起)
3条答案
按热度按时间hsvhsicv1#
就我个人而言,如果我是你,我会使用Autoit powershell模块来完成这项任务。如果您下载了zip文件,您需要将zip文件中的目录“install\AutoitX”解压缩到计算机上的某个位置。当然,在此之前一定要先解除对zip文件的阻止。然后,导入autoit powershell模块,您可以使用以下代码发送emulate按下您提到的键:
csga3l582#
用于Windows密钥的SendKeys的密钥绑定如下:
gkl3eglg3#
AutoIt响应按预期工作,因为SendKeys能够按Windows键,但不能按windowskey +另一个键。
下载AutoIt zip并将
AutoItX
文件夹保存到永久位置:https://www.autoitscript.com/site/autoit/downloads/
按windowskey + e的示例代码:
(我会把这个作为对现有AutoIt答案的评论,但我还没有50的声誉,对不起)