Differences

This shows you the differences between the selected revisions of the page.

2021-06-28 2021-06-30
formatting (martin) script generation (martin)
Line 38: Line 38:
<code batch> <code batch>
-if exist c:\upload\test.txt winscp.com /script=upload.txt+if exist c:\upload\test.txt winscp.com /ini=nul /log=upload.log /script=upload.txt 
 +</code> 
 + 
 +If you need different conditions for individual script commands, you can generate the WinSCP script file on the fly step by step: 
 + 
 +<code batch> 
 +@echo off 
 +set FILE1=c:\upload\test.txt 
 +set FILE2=c:\other\file.txt 
 + 
 +
 +  echo open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xxxxxxxxxxx...=" 
 +  if exist %FILE1% echo put %FILE1% 
 +  if exist %FILE2% echo put %FILE2% 
 +  echo <nohilite>exit</nohilite> 
 +) > upload.txt 
 + 
 +winscp.com /ini=nul /log=upload.log /script=upload.txt
</code> </code>

Last modified: by martin