# 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](https://docs.parallels.com/landing/parallels-desktop-developers-guide/command-line-interface-utility/manage-virtual-machines-from-cli/general-virtual-machine-management/send-a-keyboard-event-to-a-virtual-machine/list-of-parallels-keyboard-key-codes). See examples [below](#examples).

**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:

```json
[
	{ "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" }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parallels.com/landing/parallels-desktop-developers-guide/command-line-interface-utility/manage-virtual-machines-from-cli/general-virtual-machine-management/send-a-keyboard-event-to-a-virtual-machine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
