bzamfir
bzamfir

Reputation: 4886

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?

Upvotes: 2

Views: 430

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202168

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.

Upvotes: 4

Related Questions