Differences
This shows you the differences between the selected revisions of the page.
script_upload_file_list 2017-10-04 | script_upload_file_list 2022-06-16 (current) | ||
Line 16: | Line 16: | ||
UserName = "user" | UserName = "user" | ||
Password = "mypassword" | Password = "mypassword" | ||
- | SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..." |
} | } | ||
Line 44: | Line 44: | ||
exit 0 | exit 0 | ||
} | } | ||
- | catch [Exception] | + | catch |
{ | { | ||
Write-Host "Error: $($_.Exception.Message)" | Write-Host "Error: $($_.Exception.Message)" | ||
Line 52: | Line 52: | ||
===== [[scripting]] Using WinSCP Scripting ===== | ===== [[scripting]] Using WinSCP Scripting ===== | ||
- | You may use following batch file that calls WinSCP [[scripting|script]]: | + | You may use following batch file that calls generated WinSCP [[scripting|script]]: |
<code batch> | <code batch> | ||
@echo off | @echo off | ||
- | set SESSION=sftp://user:password@example.com/ | + | set SESSION=sftp://user:password;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/ |
set REMOTE_PATH=/home/user/ | set REMOTE_PATH=/home/user/ | ||
- | echo open %SESSION% >> script.tmp | + | ( |
+ | ··echo open %SESSION% | ||
+ | echo <nohilite>cd</nohilite> %REMOTE_PATH% | ||
- | rem Generate "put" command for each line in list file | + | ··rem Generate "put" command for each line in list file |
- | for /F %%i in (list.txt) do echo put "%%i" "%REMOTE_PATH%" >> script.tmp | + | ··for /F %%i in (list.txt) do echo put "%%i" |
- | echo exit·>> script.tmp | + | ··echo <nohilite>exit</nohilite> |
+ | ) > script.tmp | ||
- | winscp.com /script=script.tmp | + | winscp.com /ini=nul /log=script.log /script=script.tmp |
set RESULT=%ERRORLEVEL% | set RESULT=%ERRORLEVEL% | ||