ohos-window is a window management CLI (Command Line Interface) tool provided by HarmonyOS, used to operate windows or query window information. The tool outputs execution results in JSON format and provides detailed error codes, error causes, and resolution suggestions. The installation path of ohos-window is /system/bin/cli_tool/executable/ohos-window.
View help information and all subcommands.
The following two command formats are supported:
# Method 1 ohos-window help # Method 2 ohos-window --help
ohos-window restore-window [options]
If options is not specified, calling this command returns the ERR_INVALID_INPUT error code.
| Name | Description |
|---|---|
| --windowId <id> | Optional. Here, id is the windowId of the main window to be restored to the foreground, and it must be a non-negative integer. Cannot be used together with --help. |
| --help | Optional. View help information. Cannot be used together with --windowId <id>. |
| Error Code | Description | Handling Suggestion |
|---|---|---|
| ERR_INVALID_INPUT | Invalid input parameter. | Check whether the parameter complies with the parameter description. |
| ERR_NO_PERMISSION | Permission verification failed. | Check whether the ohos.permission.CONTROL_DEVICE permission is configured. |
| ERR_DEVICE_NOT_SUPPORT | The device does not support it. | Check the current device type. |
| ERR_IPC_FAILED | IPC communication or service connection failed. | Please retry. |
| ERR_INVALID_OPERATION | The operation is not allowed in the current state. | Use this command after the device is unlocked. |