1、上传
winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://bypass:abc123!@192.168.150.129:22" "option transfer binary" "put D:\1.txt /tmp/" "exit" /log=log_file.txt
@ECHO OFF
cd C:\Program Files (x86)\WinSCP
winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://bypass:abc123!@192.168.150.129:22" "option transfer binary" "get /tmp D:\test\app\" "exit" /log=log_file.txt
2、下载
winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://bypass:abc123!@192.168.150.129:22" "option transfer binary" "get /tmp D:\test\app\" "exit" /log=log_file.txt
Linux
#! /bin/sh
echo "Starting to sftp..."
lftp -u root,abc123! sftp://192.168.204.130 << EOF
cd /tmp
mget *.*
bye
EOF
echo "done"