Differences
This shows you the differences between the selected revisions of the page.
2012-06-07 | 2012-09-15 | ||
Restored revision 1338465723. Undoing revision 1339024748. (martin) (hidden) | no summary (84.245.14.29) (hidden) | ||
Line 114: | Line 114: | ||
option confirm off | option confirm off | ||
# Connect using a password | # Connect using a password | ||
- | # open sftp://user:password@example.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | # open sftp://root:pikkie2305@192.168.1.105 |
# Connect | # Connect | ||
- | open sftp://user@example.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | # open sftp://user@example.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" |
# Change remote directory | # Change remote directory | ||
- | cd /home/user | + | cd //private/var/mobile/Documents/Installous/Downloads/ |
# Force binary mode transfer | # Force binary mode transfer | ||
option transfer binary | option transfer binary | ||
# Download file to the local directory d:\ | # Download file to the local directory d:\ | ||
- | get examplefile.txt d:\ | + | get *.png d:\ |
# Disconnect | # Disconnect | ||
close | close | ||
- | # Connect as a different user | ||
- | open user2@example.com | ||
- | # Change the remote directory | ||
- | cd /home/user2 | ||
- | # Upload the file to current working directory | ||
- | put d:\examplefile.txt | ||
- | # Disconnect | ||
- | close | ||
- | # Exit WinSCP | ||
- | exit | ||
- | </code> | ||
- | Save the script to the file ''example.txt''. To execute the script file use the following command. As the script connects the session itself, using the command ''open'', omit the ''session'' command-line parameter. | ||
- | <code> | ||
- | winscp.exe /console /script=example.txt | ||
- | </code> | ||
- | |||
- | For simple scripts you can specify all the commands on [[commandline|command-line]] using ''/command'' switch: | ||
- | <code> | ||
- | winscp.exe /console /command "option batch abort" "open user@example.com" "get examplefile.txt d:\" "exit" | ||
- | </code> | ||
- | |||
- | Instead of using ''open'' command you can also open a session using a [[commandline|command-line parameter]]. Note that in that case session is opened yet before script starts. Particularly ''option'' commands do not apply yet. Generally you should avoid using this method. | ||
- | <code> | ||
- | winscp.exe /console /script=example.txt user@example.com | ||
</code> | </code> | ||