以批处理脚本发送Windows Key [英] Send Windows Key in batch script
问题描述
我最近一直在使用Batch脚本使用 SendKeys 函数.
I've recently been using the SendKeys function using Batch script.
我已经了解了如何在窗口中输入某些键,例如Tab键:
I've understood how to input certain keys into a window, such as the tab key:
%SendKeys% "{TAB}"
或退格键:
%SendKeys% "{BACKSPACE}"
但是我一直试图在不按Windows键的情况下输入Windows键.
But I have been trying to input the Windows key without pressing it.
不幸的是,我不知道它的批次名称是什么. 我尝试过:
Unfortunately, I do not know what the batch name for it is. I've tried:
WIN
WINDOWS
WINKEY
START
LWIN
但没有一个起作用.
为此,我到处都在寻找,将不胜感激.
I've looked everywhere for this, and help would be greatly appreciated.
推荐答案
There is currently no way to simulate the windows home logo in sendkey's, howevery this does not mean it's not possible.
如果您查看 Windows快捷键您会发现可以使用以下按键组合来模拟 Open Start : Ctrl + Esc .
If you take a look at the windows shortcut keys 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}"
.
To simulate this in batch, you can use: powershell -c "$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
or in your case: %SendKeys% "^{ESCAPE}"
.
如sendkeys中所述:
As stated in sendkeys:
- " ^ "-模拟 Ctrl 按键.
- " {ESCAPE} "-模拟 Esc 按键.
- "^" - Simulates a Ctrl key press.
- "{ESCAPE}" - Simulates a Esc key press.
这篇关于以批处理脚本发送Windows Key的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!