Topic "run script that works on one server; doesn't work on another"

Author Message
tbaldwin
[View user's profile]

Joined: 2012-05-07
Posts: 1
Location: pittsburgh, pa
Have a group of scripts on one server. The version of winscp on that server is 5.7.6.
The FTP site credential is set up in the winscp gui.
There is a batch script that gets called from "control-m" scheduler.
The batch script looks like this and has a switch to call another text file that contains the ftp commands.
----------------------------------------------------------------------------------------------------
rem - run winscp to pull the files from bank FTP server
rem -------------------------------------------------------------------
CD C:\APPS\BANK
rem - the file getbankfile.txt is located in the above directory
C:\"Program Files"\WinSCP\winscp.exe /console /script=GetBankFile.txt
rem -------------------------------------------------------------------
rem - copy the files to the backup folders
xcopy C:\bank\in\bankfile.* \\backups\Banks
-----------------------------------------------------------------------------------------------------

Below is the contents of the getbankfile.txt
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Connect using a password
# open user:password@example.com
# Connect
open ABC123@ftp.bank.com
binary
cd outbound
get BANKFILE* C:\bank\in\
bye


Now, I copied these files onto a new server, installed winscp version 5.9.1. and tried to run these from the scheduler. They don't work.

If I double click the .bat file directly on that server, it runs.

Additionally, I generated this script on the new server and it came up with the following:
"C:\Program Files\WinSCP\WinSCP.com" ^
/log="D:\WinscpLogs\ftplogs.log" /ini=nul ^
/command ^
"open ftpes://ABC123:Password@ftp.bank.com/"^
"get BANKFILE* C:\bank\in\" ^
"exit"

Called this batch file through the scheduler and it worked. This good that it worked, but I have dozens of ftp scripts that would potentially need converted using this method.

Is there some configuration that I need to set on the new server that would enable me to use the scripts already created in the first example?

Thanks,
-Tim
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Your script relies on a stored site, what is not recommended. So the script is not portable.
https://winscp.net/eng/docs/scripting#configuration

You can export the configuration and move it to the other server:
https://winscp.net/eng/docs/config
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License