如何发送CTRL或ALT +其他任何键? [英] How to send CTRL or ALT + any other key?
本文介绍了如何发送CTRL或ALT +其他任何键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有Powershell脚本,它将打开网页(Selenium)并将焦点放在消息"框中.现在,我想模拟 Ctrl + V 从剪贴板粘贴我的数据.有没有办法在纯Powershell中做到这一点? 可以在powershell函数中使用的C#代码也很棒.
I have powershell script which will open web page (Selenium) and set focus on the "Message" box. Now, I want to simulate Ctrl+V to paste my data from clipboard. Is there any way to do that in pure powershell? An C# code that can be used in powershell function would be also great.
推荐答案
您可以发送修饰键组合 Ctrl + C ,如下所示:
You can send the modifier key combination Ctrl+C like this:
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.SendKeys]::SendWait("^{c}")
修饰键为:
Key | Code
-----------
SHIFT +
CTRL ^
ALT %
您可能想要的其他键:
Key | Code
-----------
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER}or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}
这篇关于如何发送CTRL或ALT +其他任何键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文