Zek*_*ung 5 command-line cmd batch-file command-prompt sendkeys
我最近一直在使用批处理脚本的SendKeys函数。
我已经了解如何将某些键输入到窗口中,例如 Tab 键:
%SendKeys% "{TAB}"
Run Code Online (Sandbox Code Playgroud)
或退格键:
%SendKeys% "{BACKSPACE}"
Run Code Online (Sandbox Code Playgroud)
但是我一直在尝试输入 Windows 键而不按下它。
不幸的是,我不知道它的批次名称是什么。我试过了:
WIN
WINDOWS
WINKEY
START
LWIN
Run Code Online (Sandbox Code Playgroud)
但没有一个奏效。
我到处找这个,帮助将不胜感激。
目前还没有办法在sendkey中模拟windows home 徽标,但这并不意味着它不可能。
如果您查看Windows 快捷键,您会发现可以使用以下组合键模拟“打开开始”Ctrl : + Esc。
要批量模拟此操作,您可以使用:powershell -c "$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}') 或在您的情况下: %SendKeys% "^{ESCAPE}"。
正如sendkeys中所述:
你可以编写一个程序来模拟winkey被按下。
WinKey+R.VB
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Public Module SendWinKey
Const KEYEVENTF_KEYDOWN As Integer = &H0
Const KEYEVENTF_KEYUP As Integer = &H2
Declare Sub keybd_event Lib "User32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UInteger)
Public Sub Main()
keybd_event(CByte(Keys.LWin), 0, KEYEVENTF_KEYDOWN, 0) 'press the left Win key down
keybd_event(CByte(Keys.R), 0, KEYEVENTF_KEYDOWN, 0) 'press the R key down
keybd_event(CByte(Keys.R), 0, KEYEVENTF_KEYUP, 0) 'release the R key
keybd_event(CByte(Keys.LWin), 0, KEYEVENTF_KEYUP, 0) 'release the left Win key
End Sub
End Module
Run Code Online (Sandbox Code Playgroud)
放在桌面上。
打开命令提示符并键入
C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%userprofile%\desktop\Win+R.vb" /out:"%userprofile%\Desktop\Win+R.exe" /target:winexe
Run Code Online (Sandbox Code Playgroud)
一个名为 Win+R.exe 的文件将出现在您的桌面上。将其移至路径中的任意位置。
| 归档时间: |
|
| 查看次数: |
28823 次 |
| 最近记录: |