I have the below command I started writing to copy a file from a local box to the remote directory. I am very new to this and confused by the documentation somewhat. Can I use the "Your Command 1 and 2"
params at the end to do like "c:\somefile.txt" "\in\"
?
I want to do this without PowerShell, or script. Just raw command line and no additional files to import in command line args. My goal is to set up a Windows Task Scheduler job and has it run this single command.
C:\Program Files (x86)\WinSCP\WinSCP.exe /log="C:\writable\path\to\log\WinSCP.log" /ini=nul /command "open sftp://myusername@myftpsite.com/ -hostkey=""ssh-rsa 2048 wbb2bQRmDJqkaLbuYKsnGdxQ40mIIedeXChRsAYC3ig="" -privatekey=""C:\Users\my.user\Documents\SSHPrivateKey.ppk""" "Your command 1" "Your command 2" "exit"
I see some examples here… https://winscp.net/eng/docs/commandline#scripting
Can't find auto-generate code function in transfer settings for full script code...
The command to upload a file is put
. You can place it instead of the "Your command 1" "Your command 2"
placeholders like this:
"C:\...\WinSCP.exe" ... /command "open ..." "put C:\local\file.zip /remote/" "exit"
WinSCP GUI can generate a complete command-line including the put
command for you: