harmony 鸿蒙power-shell工具

  • 2025-06-16
  • 浏览 (1)

power-shell工具

power-shell是实现设备电源状态转换等功能的工具,为开发者提供基本的设备电源状态调试能力,例如:熄屏、唤醒、设置电源模式等。

环境要求

在使用本工具前,开发者需要先获取hdc工具,执行hdc shell。

power-shell命令工具列表

命令 描述
help 帮助命令,显示power-shell支持的命令信息。
setmode 设置电源模式命令,用来设置当前设备的电源模式。
wakeup 亮屏命令,用来唤醒系统并亮屏。
suspend 熄屏命令,用来暂停系统并熄屏。
timeout 自动熄屏命令,用来覆盖或恢复系统设置中自动熄屏时间。

帮助命令

# 显示帮助信息
power-shell help

设置电源模式命令

power-shell setmode

设置电源模式命令列表

命令                                 描述                      
power-shell setmode -h  显示setmode支持的命令信息。
power-shell setmode 600 正常模式。
power-shell setmode 601  省电模式。
power-shell setmode 602  性能模式。
power-shell setmode 603 超级省电模式。

示例:

# 设置设备电源状态为正常模式
power-shell setmode 600
# 设置设备电源状态为省电模式
power-shell setmode 601
# 设置设备电源状态为性能模式
power-shell setmode 602
# 设置设备电源状态为超级省电模式
power-shell setmode 603

亮屏命令

power-shell wakeup

亮屏命令列表

命令                           描述                    
power-shell wakeup 亮屏。

示例:

# shell命令亮屏
power-shell wakeup

熄屏命令

power-shell suspend

熄屏命令列表

命令       描述                      
power-shell suspend 熄屏。

示例:

# shell命令熄屏
power-shell suspend

自动熄屏命令

power-shell timeout

自动熄屏命令参数列表 |参数      |参数说明                      | |———-|————————–| |-o <time>|必选参数,设置自动熄屏时间。[time]单位为毫秒。| |-r|必选参数,恢复到当前系统设置中的自动熄屏时间。|

示例:

# 当前系统设置中自动熄屏时间为30秒
# shell命令设置自动熄屏时间为15000毫秒
power-shell timeout -o 15000
# 恢复系统设置的自动熄屏时间,此时自动熄屏时间为30秒
power-shell timeout -r

你可能感兴趣的鸿蒙文章

harmony 鸿蒙调试工具

harmony 鸿蒙aa工具

harmony 鸿蒙acm工具

harmony 鸿蒙anm工具

harmony 鸿蒙扫描工具

harmony 鸿蒙atm工具

harmony 鸿蒙bm工具

harmony 鸿蒙cem工具

harmony 鸿蒙devicedebug工具

harmony 鸿蒙edm工具

0  赞