目录

ohos-window CLI Tool

Description

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.

help

View help information and all subcommands.

The following two command formats are supported:

# Method 1
ohos-window help

# Method 2
ohos-window --help

restore-window

Restores the specified main window to the foreground.

[h2]Constraints

[h2]Command Format

ohos-window restore-window [options]

If options is not specified, calling this command returns the ERR_INVALID_INPUT error code.

[h2]Parameter Description

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>.

[h2]Error Code

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.

[h2]Sample Code

# Restore the specified main window to the foreground.
ohos-window restore-window --windowId 100

# View the help information of the restore-window command.
ohos-window restore-window --help