在批处理脚本中发送 Windows 密钥

2024-05-05

我最近一直在使用SendKeys使用批处理脚本的函数。

我已经了解如何在窗口中输入某些键,例如 Tab 键:

%SendKeys% "{TAB}"

或者退格键:

%SendKeys% "{BACKSPACE}"

但我一直尝试在不按Windows键的情况下输入它。

不幸的是,我不知道它的批次名称是什么。 我试过了:

WIN
WINDOWS
WINKEY
START
LWIN

但都没有奏效。

我到处寻找这个,非常感谢帮助。


目前还没有办法模拟Windows 主页徽标 in 发送密钥的 https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/sendkeys-statement,但这并不意味着它不可能。

If you take a look at the windows shortcut keys https://support.microsoft.com/en-us/help/12445/windows-keyboard-shortcuts you will find you can simulate Open Start with the following key combinations: Ctrl + Esc.

要批量模拟此操作,您可以使用:powershell -c "$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}') 或者在你的情况下: %SendKeys% "^{ESCAPE}".

正如sendkeys中所述:

  • "^" - Simulates a Ctrl key press.
  • "{ESCAPE}" - Simulates a Esc key press.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在批处理脚本中发送 Windows 密钥 的相关文章

随机推荐