Difference between revisions of "Winscp command line"
From MyWiki
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | http://winscp.net/eng/docs/guide_automation<br> | + | Tested using winscp portable. Download and extract all files to the working directory<br> |
+ | Calling winscp.com from dos may require '''.\winscp.com''' syntax.<br> | ||
+ | |||
+ | Reference : http://winscp.net/eng/docs/guide_automation<br> | ||
winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat""" | winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat""" | ||
+ | |||
+ | Calling a script | ||
+ | <source lang="text"> | ||
+ | @echo off | ||
+ | winscp.com /script=myscript.txt | ||
+ | </source> | ||
+ | Script contents as follows: | ||
+ | <source lang="text"> | ||
+ | # Script contents | ||
+ | # Automatically abort script on errors | ||
+ | option batch abort | ||
+ | # Disable overwrite confirmations that conflict with the previous | ||
+ | option confirm off | ||
+ | # Connect to SFTP server using a password | ||
+ | open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | ||
+ | # Upload file | ||
+ | put d:\examplefile.txt /home/user | ||
+ | # Disconnect | ||
+ | close | ||
+ | </source> |
Latest revision as of 15:24, 18 May 2015
Tested using winscp portable. Download and extract all files to the working directory
Calling winscp.com from dos may require .\winscp.com syntax.
Reference : http://winscp.net/eng/docs/guide_automation
winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat"""
Calling a script
@echo off winscp.com /script=myscript.txt
Script contents as follows:
# Script contents # Automatically abort script on errors option batch abort # Disable overwrite confirmations that conflict with the previous option confirm off # Connect to SFTP server using a password open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" # Upload file put d:\examplefile.txt /home/user # Disconnect close