batch-fileftpwinscp

Running WinSCP script displays nothing


I'm trying to use WinSCP through script to synchronize a local folder with an FTP one.

I created a script a below

open ftp://<user>:<pw>@ftp.myserver.com/initFolder/
synchronize remote -delete C:\Data\backup /initFolder/
exit

And I run it with the command

"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\data\bin\log\WinSCP.log" /ini=nul /script="C:\data\bin\myScript.txt"

However, it appears nothing is happening. The command exists immediately with no message (either error or some processing / confirmation, etc).

Also no log file is created either.

What am I doing wrong?


Solution

  • Indeed, with the command-line syntax you are using, WinSCP runs without any GUI.

    If you are starting WinSCP from a console window (e.g. from Windows batch file or PowerShell), use winscp.com instead of winscp.exe. winscp.com is a console application. You will see any errors in the console.

    Alternatively, you can add /console switch to winscp.exe command-line to make it open its own console window. Though you will rarely want this.