WINSCP Automatic Script execution

Source: Internet
Author: User

We often use the WINSCP tool to upload get files via the SFTP protocol, which describes batch processing of files through bat.

First, we open the DOS command window using CD \d:D \WINSCP to open the WinSCP installation directory

Upload file:

Winscp.exe/console/command "option Batch Continue" "option confirm off" "open Sftp://user:[email Protected]:p ort" "Optio N Transfer binary "" Put d:\ file path to upload/server file directory "exit"/log=log_file.txt

Here for the convenience of understanding, explained.

Winscp421.exe/console/command command name
"Option batch Continue" default batch
"option confirm off" prompt message
"Open ftp://user:[email protected]:p ort" User: Access username, pwd: User password, IP:IP address, Port: port number Default 22
"Option Transfer binary" is transmitted using binary format

Log=log_file.txt log file Address
"Exit":: Exit after executing command

Note: The above command after the parameters should be reflected in a line as you want to write separately can put the command to a file

such as: Aa.txt

Option echo off
Option Transfer Binary
Open <sftp_or_ftp>://<user>:<password>@CD <remote_dir>
Put *.doc
Exit

Execute the script with a command:winscp/script=aa.txt/ini=<winscp.ini_location>/log=<log_file>
If you need to configure the transport parameters in the Winscp.ini configuration, for example preservetime=0 keep the timestamp of the source file

Download file:

Here is the download file code, as with the upload, such as the need to write a separate script can be used as a separate save script execution.

CD/D D:\WinSCP
Winscp.exe/console/command "option Batch Continue" "option confirm off" "Open sftp://root:[email protected]:22" "option Transfer binary "" Get/test.txt D:\sftptest\ "Exit"/log=d:\sftptest\log.txt

WINSCP Automatic Script execution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.