bat脚本 : SCP命令从远程主机拷贝文件

发布时间 2023-10-11 17:34:13作者: memo2586

学习HI3861时要经常从远程主机拷贝烧录的文件

@echo off
setlocal enabledelayedexpansion

set remote_username=memo2586
set remote_host=192.168.73.xxx
set remote_path=/home/memo2586/OH-HiHope/out/hispark_pegasus/wifiiot_hispark_pegasus/Hi3861_wifiiot_app_allinone.bin
set local_path=%cd%/
:: set remote_port= 

:: 设置SCP路径,确保SCP可执行文件在系统PATH中
set scp_command=scp

:: 使用SCP命令拷贝文件

::本地
%scp_command% %remote_username%@%remote_host%:%remote_path% "%local_path%"

::云端
::%scp_command% %remote_username%@%remote_host%:%remote_path% "%local_path% -P %remote_port%"