Send a Keyboard Event to a Virtual Machine
prlctl send-key-event <VM ID> -k,--key <key> | -s,--scancode <scancode> [-e,--event <press|release>] [-d,--delay <msec>]
Sends a single keyboard event (key press or release) identified with a specific key code or scancode to a specified virtual machine with a specified delay (in milliseconds). For the complete list of key codes, see this subchapter. See examples below.
prlctl send-key-event <VM ID> -j,--json
Sends a sequence of keyboard events by reading JSON input from stdin. An example of the format is:
[
{ "key": 13 },
{ "key": 7, "event": "press" },
{ "scancode": 7, "event": "release", "delay": 100 },
{ "delay": 100 },
{ "k": 50, "event": "press", "delay": 100 },
{ "s": 10, "event": "release", "d": 100 },
]
Examples
If you would like to type "test" and press Enter, the sequence of commands would be:
% prlctl send-key-event "<VM_name>" -k 28
% prlctl send-key-event "<VM_name>" -k 26
% prlctl send-key-event "<VM_name>" -k 39
% prlctl send-key-event "<VM_name>" -k 28
% prlctl send-key-event "<VM_name>" -k 36
If you would like to enter a combination like Win+PrtScr, the command would be:
prlctl send-key-event "<VM_name>" -j
[
{ "key": 115, "event": "press", "delay": 100 },
{ "key": 92, "delay": 100 },
{ "key": 115, "event": "release" }
]
Last updated