当前位置:   article > 正文

hdc_std安装配置以及常用命令

hdc_std

前言:(时间紧迫就别看前言了)hdc_std是OpenHarmony 的命令行工具。因为我们的鸿蒙系统没有应用商店、没有浏览器、不能外接usb设备以及打不开文件资源管理器,所以接触了hdc_std。

环境:Windows10电脑        工具:usb连接线、鸿蒙系统测试机

一、环境安装配置

1.新建一个文件夹并命名,作为存放hdc_std的路径,把.exe文件放到新建的文件夹中。

2.回到桌面,右击“此电脑”->点“属性”,点击高级系统设置,然后点环境变量。

3.在系统变量中找到Path,然后点编辑按钮。

4.把hdc_std.exe的路径复制一下,在编辑环境变量页面点“新建”,把路径粘贴到左侧,如图。

5.打开命令提示符(cmd),输入:hdc_std -v,如下图有版本号则成功。

二、常用命令(电脑USB已连接设备)

hdc_std start        #启动hdc_std

hdc_std kill        #关闭hdc_std

hdc_std start -r    #重新启动hdc服务进程

hdc_std target boot    #重启设备

hdc_std -h        #查看帮助

  1. OpenHarmony device connector(HDC) ...
  2. ---------------------------------global commands:----------------------------------
  3. -h/help - Print hdc help
  4. -v/version - Print hdc version
  5. -l 0-5 - Set runtime loglevel
  6. -t connectkey - Use device with given connect key
  7. ---------------------------------component commands:-------------------------------
  8. session commands(on server):
  9. discover - Discover devices listening on TCP via LAN broadcast
  10. list targets [-v] - List all devices status, -v for detail
  11. tconn key - Connect device via key, TCP use ip:port
  12. example:192.168.0.100:10178/192.168.0.100
  13. USB connect automatic, TCP need to connect manually
  14. start [-r] - Start server. If with '-r', will be restart server
  15. kill [-r] - Kill server. If with '-r', will be restart server
  16. -s [ip:]port - Set hdc server listen config
  17. service commands(on daemon):
  18. target mount - Set /system /vendor partition read-write
  19. target boot [-bootloader|-recovery] - Reboot the device or boot into bootloader\recovery.
  20. smode [-r] - Restart daemon with root permissions, '-r' to cancel root
  21. permissions
  22. tmode usb - Reboot the device, listening on USB
  23. tmode port [port] - Reboot the device, listening on TCP port
  24. ---------------------------------task commands:-------------------------------------
  25. file commands:
  26. file send [option] local remote - Send file to device
  27. file recv [option] remote local - Recv file from device
  28. option is -a|-s|-z
  29. -a: hold target file timestamp
  30. -sync: just update newer file
  31. -z: compress transfer
  32. forward commands:
  33. fport localnode remotenode - Forward local traffic to remote device
  34. rport remotenode localnode - Reserve remote traffic to local host
  35. node config name format 'schema:content'
  36. examples are below:
  37. tcp:<port>
  38. localfilesystem:<unix domain socket name>
  39. localreserved:<unix domain socket name>
  40. localabstract:<unix domain socket name>
  41. dev:<device name>
  42. jdwp:<pid> (remote only)
  43. fport ls - Dispaly forward/reverse tasks
  44. fport rm taskstr - Remove forward/reverse task by taskstring
  45. app commands:
  46. install [-rdg] src - Send package(s) to device and install them
  47. src examples: single or multiple packages and directories
  48. (.hap)
  49. -r: replace existing application
  50. -d: allow version code downgrade
  51. -g: grant all the permissions
  52. uninstall [-k] package - Remove application package from device
  53. -k: keep the data and cache directories
  54. debug commands:
  55. hilog [-v] - Show device log, -v for detail
  56. shell [COMMAND...] - Run shell command (interactive shell if no command given)
  57. bugreport [PATH] - Return all information from the device, path will be save localpath
  58. jpid - List pids of processes hosting a JDWP transport
  59. sideload [PATH] - Sideload the given full OTA package
  60. security commands:
  61. keygen FILE - Generate public/private key; key stored in FILE and FILE.pub

hdc_std shell    #进入命令行交互环境

hdc_std list targets    #查看已连接设备

hdc_std list targets -v    #查看连接设备的详细信息

hdc_std shell param get        #查看设备信息

hdc_std target mount    #获取读写权限

hdc_std shell param set persist.multimedia.audio.mediavolume = 1        #设置机器的声音大小,默认值是15

hdc_std file send [D:\本地路径] [/data/设备路径]    #发送文件到设备

hdc_std file recv [/data/设备路径] [D:\本地路径]    #获取文件到本地

hdc_std shell chromd ***    #修改文件权限

hdc_std shell hilog    #查看日志

hdc_std shell ps -ef    #查看进程

hdc_std app install -r [HAP包路径]    #递归当前目录安装HAP包(安装包在电脑上)

hdc_std shell bm install -p /data/entry-default-signed.hap    #HAP包推送到手机中,手动安装HAP包(安装包在手机上)

hdc_std uninstall [安装包名称]    #卸载HAP包

hdc_std shell bm uninstall -n [安装包名称]    #卸载HAP包

hdc_std shell aa start ability -a InputMethod -b cn.openharmony.inputmethodchoosedialog        #切换输入法。在屏幕上选择想要的输入法

ifconfig        #查看设备的ip等信息

ifconfig eth0 up

ifconfig eth0 192.168.1.7 netmask 255.255.255.0 broadcast 192.168.1.255        #设置ip地址、网关和子网掩码

ping IP地址        #测试地址是否可用

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/242695
推荐阅读
相关标签
  

闽ICP备14008679号