Configure WinSCP to upload automatically to SFTP

I needed to automate the upload of csv files to an SFTP server for print fulfilment. It was a bit trickier than I thought it would be so I recorded what I did in case I need to do it again someday.

1)     Download and install WinSCP from here:

2)     Create a folder where files will be uploaded from and a sub folder called Archive

3)     Open WinSCP go to Options Select Storage and Set Configuration Storage to INI file (WinSCP.ini), close WinSCP.

4)     Add a the PATH to the WinSCP install folder in the Environment Variables

5)     Create a file in the upload folder called SftpScript.txt

6)     Create a .cmd file and add the following command, modify the path to SftpScript.txt /console /script=C:FilesPrintFulfilmentSftpScript.txt >> SftpUpload.log

7)     Add the following code to SftpScript.txt, update the parameters highlighted in red.


# Automatically answer all prompts negatively not to stall the script on errors

option batch on


# Disable overwrite confirmations that conflict with the previous

option confirm off


# Connect using a password



# Force binary mode transfer

option transfer binary


# Change to home directory



# Upload the file to current working directory

put C:FilesPrintFulfilment*.csv


# Disconnect


# Exit WinSCP



8)     To prevent the same file being uploaded next time the command runs add the following to the .cmd File, updating the file mask and archive folder path.


MOVE *.csv C:FilesPrintFulfilmentArchive

2 thoughts on “Configure WinSCP to upload automatically to SFTP”

  1. Quite useful. But how do I schedule the above activity daily. I want this command to upload file daily to remote location at 6 PM. Thanks in advance

Comments are closed.