openharmony 鸿蒙 power-shell

2025-06-12 浏览 (1)

power-shell

power-shell is a tool used to convert the power status of a device. It provides basic capabilities such as turning off the screen, waking up the device, and setting the power mode.

Environment Setup

Before using this tool, you must obtain hdc and run the hdc shell command.

power-shell commands

CommandDescription
helpObtains the help information about the commands supported by power-shell.
setmodeSets the power mode of the current device.
wakeupWakes up the system and turns on the screen.
suspendSuspends the system and turns off the screen.
timeoutOverwrites or restores the automatic screen-off time in system settings.

help

# Display the help information.
power-shell help

setmode

power-shell setmode

setmode commands

CommandDescription
power-shell setmode -hDisplays the parameters supported by the setmode command.
power-shell setmode 600Enables the normal power mode.
power-shell setmode 601Enables the power saving mode.
power-shell setmode 602Enables the performance mode.
power-shell setmode 603Enables the ultra power saving mode.

Example:

# Enable the normal power mode.
power-shell setmode 600
# Enable the power saving mode.
power-shell setmode 601
# Enable the performance mode.
power-shell setmode 602
# Enable the ultra power saving mode.
power-shell setmode 603

wakeup

power-shell wakeup

wakeup command

CommandDescription
power-shell wakeupTurns on the screen.

Example:

# Run the shell command to turn on the screen.
power-shell wakeup

suspend

power-shell suspend

suspend command

CommandDescription
power-shell suspendTurns off the screen.

Example:

# Run the shell command to turn off the screen.
power-shell suspend

timeout

power-shell timeout

timeout commands

ParameterDescription
-o <time>Sets the automatic screen-off time. This parameter is mandatory. in milliseconds.
-rRestores the automatic screen-off time in the current system settings. This parameter is mandatory.

Example:

# The automatic screen-off time is set to 30s in the current system settings.
# Run the shell command to set the automatic screen-off time to 15000 ms.
power-shell timeout -o 15000
# Restore the automatic screen-off time set by the system, which is 30s.
power-shell timeout -r

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Debugging Tools

harmony 鸿蒙Ability Assistant

harmony 鸿蒙Account Manager

harmony 鸿蒙Advanced Notification Manager

harmony 鸿蒙App Check Tool

harmony 鸿蒙Access Token Manager

harmony 鸿蒙Bundle Manager

harmony 鸿蒙Common Event Manager

harmony 鸿蒙devicedebug

harmony 鸿蒙EDM

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/YqmcKI