# Cmd Example

Let's consider an example of a robot that demonstrates the principle of working with the command line. In this case, commands are loaded from an xlsx file and executed randomly.

The robot project consists of one diagram and an xlsx file. Thus, if we describe step by step, this robot works as follows:

1. Loads the Data Table from the xlsx file.
2. Using the "Random Number" block, selects a row from the table.
3. Opens a window with the command line.
4. Executes the command from the previously selected row of the table.
5. After executing the command, closes the command line window.

The project diagram looks like this (for convenience, the blocks of the diagram are numbered):

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdvsz8MZQ4CEr84Vf-zODTGgTUeJp5VhJYlp-eb9xtqL4ORfhTYpE1v3Vh-UUhpGEe4Ou0byrHN_qNdRtawS1IsYgqxHVOAp3xyOj8g2Tq0wgHL58JoYx8KaXhBtrL4mCwNm3rrMoiQwQWqqwEadxsif6o?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

1. **"Start" Block** (any diagram starts from this block).
2. **"Load Data Table" Block** allows loading a data table from an xlsx file. The following properties are specified for this block:

* File path (the path to the xlsx file from which information needs to be loaded into the Data Table);
* Header (if the flag is set, the first row of the table will be used as a header);
* Sheet (ID or name of the sheet whose data needs to be saved in the Data Table).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXe7wDEcBVup9HCqs5hmq7Ebe8NgyBxaYkXuKNMvfrLM11NsFvxbJvNbKZySeuNB-fnWcxkKgDxnkEM-B3tEwCPLStY850pnV8eax9mahQNK0mFAHLAJO_nxrKGzOD6sXA3VO3cwQsvmNHVDqBCSibqFJIAZ?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

3. **"Random Number" Block** generates a random number with specified parameters. The following properties are specified for this block:

* Min. value (minimum value for the random number);
* Max. value (maximum value for the random number);
* Step (step of the random number).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXe7P4JTkyKqtp34defivCP2cJrR3rT8cVgQmyr7iXrZ2D-k4bAY88ZVH9GkWX0APpIuseTFJ88AANKVrNt0Un1FyUrE6LsTr0cTLeCR0r0CxbYoWHEV-1XqKKxsPrquQO7NqlxQhyYQSPxB8gg-jBTndW7u?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

4. **"Assign Value to Variable" Block** sets new values for one or more variables. In this case, one value is specified in the properties that needs to be assigned to a specific variable.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfaZipL3olPn7IQAZkgH6S_hPGof5BJPP_0eLwuiC3ag8StLjP3AEiXngD9Y2DrbVcr5_72Y5xXeyBStPtEJut1AVE8ARtSTdh1nzl7OJ2hvIlhyV7Jd129dKUYe0i5FING0s0aoRAX2C0gXOys6gsiw0YW?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

5. **"Launch Application" Block** launches the specified application with the given parameters. For this block, the properties specify the path to the application (the name of the standard application).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdOJe4a3xRk-bDNqnyjtP4dGcAE_euXnS07OTqEwVLsXve7JhTs0hOR5wo_O6NlFycYCcMk5p69DfrXPBdcN5tlHTCYfu7P4ktQtUXyyArwtl95bsauRjhK8SRHERVJ2iYdvPVbPT--CrFVW7YxyvERsEoy?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

6. **"Pause" Block** pauses the execution of the script for a specified time. The following properties are specified for this block:

* Unit of measurement (the unit of measurement in which the duration of the pause is specified);
* Duration (the number of seconds for which the script will be paused).
* Start immediately (if the flag is set, the delay will be applied immediately on the first pass of this block from the moment the robot's script starts).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf679Q19xPtYgbL6MJ4vA-gROKnNUqS7JsYprX3EhWQn0K9WB1LsiQjOBQ9kpptiVdrlbnXRCDWcyiqgep83NBbRg1Oir2-nNJPgeO6SnX-LlesCcJnU-C2H-p6FpEuxfiCXhDo_nTO-WigaWoo9VrnypI?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

7. **"Press Keys" Block** emulates key presses on the keyboard. The following properties are specified for this block:

* Keys (text or keys that need to be emulated);
* Process ID (a variable that stores the application identifier);
* Interactively (if the flag is set, pauses are inserted between key presses);
* Pause time (the duration of the pause between key presses in milliseconds).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdhNaN3RiT3TWvOHCqsq8-dqT8y8tlhDTguvEQP28RGen9ddgcGwaOFPqqdofB762_LapI45QasZAxukpnKrHxQbXU1FqAJ1lci2hoy1o5Kivb9TI6qsq-Cyj-klHJYjN1_XJ9QOwritgn_3hlaR6UzlEoc?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

8. **"Pause" Block** pauses the execution of the script for a specified time. The following properties are specified for this block:

* Unit of measurement (the unit of measurement in which the duration of the pause is specified);
* Duration (the number of seconds for which the script will be paused).
* Start immediately (if the flag is set, the delay will be applied immediately on the first pass of this block from the moment the robot's script starts).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfiVmBpjRNKcE50HnsNr2A393tWtfv9jw8F6WbcUZROZQo_YyY9nSqlSOrvAmr3t5bhxAbAY-kjJ_UJKet56NE9j_ld4WstaTc604Etnl5R44jUtSqP-usqB5WcK7a4WS9Mi5hB3DuMc5KgsHCxFonYf9RL?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

9. **"Close Application" Block** closes the specified application. For this block, the property "Process ID" is specified (a variable containing the identifier of the process that needs to be closed).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXe7lxCnISUh50NckXWlWYwsfWQ0K4mtfR7bO83ZWiuDUn0HBVhlixpUQgSvZYpRYI166AagRCV2Aa0sOTbUmxJc1QCx7UFC4qbaAqKXg4qJrxG3yPVDLz4fT7hUIXAEvP4vwKKUityUVWgPrFKagA661Xg?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

10. **"End" Block** (this block ends the script execution or returns the subprocess diagram to the main process).
11. **"Log" Block** allows outputting arbitrary messages and/or variable values to the log during the execution of the robot's script. For this block, the property "Value" is specified. The text constant is indicated in quotes, and the variable name starts with the symbol $. That is, this block logs an error message in the robot's operation.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXffXvYmUY961z1r6nY6jb-aMAi9aki6D3hnZcQNVJkjs6z_q288_bf-cVaNgyqJ-h8lqhPORsQyws99YMHVMDYbFJR5jOQi-zOlBI1vhpSrhcPA_JzvyANd2gfya3ZLjuvmz6RDm3cRMulxW1j9eLJ192Bk?key=6b-lfrni6g0pefzDtoJOiw" alt=""><figcaption></figcaption></figure>

12. **"End" Block** (this block ends the script execution or returns the subprocess diagram to the main process).


---

# 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.sherparpa.ru/en/sherpa-rpa/sherpa-designer/primery-robotov/cmd-example.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.
