Topic "WINSCP not returning from call from batch file"

Author Message
Socko71
[View user's profile]
Donor
Joined: 2013-03-22
Posts: 19
Location: Indiana
My batch using winscp copies a diretory from one server to another (backup). I'm testing for an invalid diretory name being sent to my batch file. When a valid name is sent the call to winscp it copies the diretory and returns back to the batch file and the errorlevel is 0. When I send a invalid diretory name winscp detects its invalid however it just hangs and doesn't return back to the batch file. It's like it's waiting for user input. Is there an option to ignor the prompt for user input? This is the output log

. 2014-12-01 14:03:59.864 --------------------------------------------------------------------------
. 2014-12-01 14:03:59.864 WinSCP Version 5.5.6 (Build 4746) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Standard)
. 2014-12-01 14:03:59.880 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2014-12-01 14:03:59.880 Local account: IFB\migrprd
. 2014-12-01 14:03:59.880 Working directory: D:\Application\jenkins\scripts
. 2014-12-01 14:03:59.880 Process ID: 2628
. 2014-12-01 14:03:59.880 Command-line: "D:\Application\winSCP\WinSCP.exe" /console=556 /consoleinstance=_3128_411 "/script=D:\Application\jenkins\scripts\Backup-wb-iisifbeb-qa.tmp" "/log=M:\backup-TST\OAMClient\OAMClient-20141103-TR030734-V7.1.7-wb-iisifbeb-qa\Logs\Backup\RCBackup.txt"
. 2014-12-01 14:03:59.880 Time zone: Current: GMT-5, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/9/2014, DST End: 11/2/2014
. 2014-12-01 14:03:59.880 Login time: Monday, December 01, 2014 2:03:59 PM
. 2014-12-01 14:03:59.880 --------------------------------------------------------------------------
. 2014-12-01 14:03:59.880 Script: Retrospectively logging previous script records:
> 2014-12-01 14:03:59.880 Script: open ftp://migrprd:***@wb-iisifbeb-qa.infarmbureau.com -explicitssl -passive=off -certificate
. 2014-12-01 14:03:59.880 --------------------------------------------------------------------------
. 2014-12-01 14:03:59.880 Session name: migrprd@wb-iisifbeb-qa.infarmbureau.com (Modified site)
. 2014-12-01 14:03:59.880 Host name: wb-iisifbeb-qa.infarmbureau.com (Port: 21)
. 2014-12-01 14:03:59.880 User name: migrprd (Password: Yes, Key file: No)
. 2014-12-01 14:03:59.880 Tunnel: No
. 2014-12-01 14:03:59.880 Transfer Protocol: FTP
. 2014-12-01 14:03:59.880 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2014-12-01 14:03:59.880 Proxy: none
. 2014-12-01 14:03:59.880 Send buffer: 262144
. 2014-12-01 14:03:59.880 UTF: 2
. 2014-12-01 14:03:59.880 FTP: FTPS: Explicit SSL; Passive: No [Force IP: A]; MLSD: A [List all: A]
. 2014-12-01 14:03:59.880 Session reuse: Yes
. 2014-12-01 14:03:59.880 TLS/SSL versions: TLSv1.0-TLSv1.2
. 2014-12-01 14:03:59.880 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2014-12-01 14:03:59.880 Cache directory changes: Yes, Permanent: Yes
. 2014-12-01 14:03:59.880 DST mode: 1; Timezone offset: 0h 0m
. 2014-12-01 14:03:59.880 --------------------------------------------------------------------------
. 2014-12-01 14:03:59.895 Connecting to wb-iisifbeb-qa.infarmbureau.com ...
. 2014-12-01 14:03:59.911 Connected with wb-iisifbeb-qa.infarmbureau.com, negotiating TLS connection...
< 2014-12-01 14:03:59.911 220-FileZilla Server version 0.9.39 beta
< 2014-12-01 14:03:59.911 220-written by Tim Kosse (Tim.Kosse@gmx.de)
< 2014-12-01 14:03:59.911 220 Please visit https://sourceforge.net/projects/filezilla/
> 2014-12-01 14:03:59.911 AUTH SSL
< 2014-12-01 14:04:00.442 234 Using authentication type SSL
. 2014-12-01 14:04:00.864 Verifying certificate for "Indiana Farm Bureau xxxxxxxx" with fingerprint 97:56:33:ec:5a:50:ee:dc:cd:04:65:dc:5a:38:30:ba:09:fe:c6:bc
. 2014-12-01 14:04:00.864 Certificate common name "*.infarmbureau.com" matches hostname
. 2014-12-01 14:04:00.864 Certificate for "Indiana Farm Bureau xxxxxxxx" matches cached fingerprint
. 2014-12-01 14:04:00.864 Using TLSv1, cipher TLSv1/SSLv3: AES256-SHA, 2048 bit RSA
. 2014-12-01 14:04:00.880 TLS connection established. Waiting for welcome message...
> 2014-12-01 14:04:00.880 USER migrprd
< 2014-12-01 14:04:00.880 331 Password required for migrprd
> 2014-12-01 14:04:00.880 PASS **********
< 2014-12-01 14:04:00.880 230 Logged on
> 2014-12-01 14:04:00.880 SYST
< 2014-12-01 14:04:00.880 215 UNIX emulated by FileZilla
> 2014-12-01 14:04:00.880 FEAT
< 2014-12-01 14:04:00.880 211-Features:
< 2014-12-01 14:04:00.880 MDTM
< 2014-12-01 14:04:00.880 REST STREAM
< 2014-12-01 14:04:00.880 SIZE
< 2014-12-01 14:04:00.880 MLST type*;size*;modify*;
< 2014-12-01 14:04:00.880 MLSD
< 2014-12-01 14:04:00.880 AUTH SSL
< 2014-12-01 14:04:00.895 AUTH TLS
< 2014-12-01 14:04:00.895 PROT
< 2014-12-01 14:04:00.895 PBSZ
< 2014-12-01 14:04:00.895 UTF8
< 2014-12-01 14:04:00.895 CLNT
< 2014-12-01 14:04:00.895 MFMT
< 2014-12-01 14:04:00.895 211 End
> 2014-12-01 14:04:00.895 PBSZ 0
< 2014-12-01 14:04:00.895 200 PBSZ=0
> 2014-12-01 14:04:00.895 PROT P
< 2014-12-01 14:04:00.895 200 Protection level set to P
. 2014-12-01 14:04:00.895 Connected
. 2014-12-01 14:04:00.895 --------------------------------------------------------------------------
. 2014-12-01 14:04:00.895 Using FTP protocol.
. 2014-12-01 14:04:00.895 Doing startup conversation with host.
> 2014-12-01 14:04:00.895 PWD
< 2014-12-01 14:04:00.895 257 "/" is current directory.
. 2014-12-01 14:04:00.895 Getting current directory name.
. 2014-12-01 14:04:00.895 Startup conversation with host finished.
< 2014-12-01 14:04:00.895 Script: Active session: [1] migrprd@wb-iisifbeb-qa.infarmbureau.com
> 2014-12-01 14:04:00.895 Script: synchronize local M:\backup-TST\OAMClient\OAMClient-20141103-TR030734-V7.1.7-wb-iisifbeb-qa\Backup oam-xxx
< 2014-12-01 14:04:00.895 Script: Comparing...
. 2014-12-01 14:04:00.911 Collecting synchronization list for local directory 'M:\backup-TST\OAMClient\OAMClient-20141103-TR030734-V7.1.7-wb-iisifbeb-qa\Backup' and remote directory 'oam-xxx', mode = Local, params = 0x2 (NoConfirmation)
. 2014-12-01 14:04:00.911 Local file 'M:\backup-TST\OAMClient\OAMClient-20141103-TR030734-V7.1.7-wb-iisifbeb-qa\Backup\.' [2014-12-01T19:02:49.641Z] [0] excluded from synchronization
. 2014-12-01 14:04:00.911 Local file 'M:\backup-TST\OAMClient\OAMClient-20141103-TR030734-V7.1.7-wb-iisifbeb-qa\Backup\..' [2014-12-01T19:02:49.641Z] [0] excluded from synchronization
. 2014-12-01 14:04:00.911 Retrieving directory listing...
> 2014-12-01 14:04:00.911 CWD /oam-xxx/
< 2014-12-01 14:04:00.911 550 CWD failed. "/oam-xxx": directory not found.
. 2014-12-01 14:04:00.911 Could not retrieve directory listing
. 2014-12-01 14:04:00.911 Asking user:
. 2014-12-01 14:04:00.911 Error listing directory 'oam-xxx'. ("Could not retrieve directory listing","CWD failed. ""/oam-xxx"": directory not found.")
< 2014-12-01 14:04:00.911 Script: Error listing directory 'oam-xxx'.
< 2014-12-01 14:04:00.911 Script: Could not retrieve directory listing

< 2014-12-01 14:04:00.911 CWD failed. "/oam-xxx": directory not found.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
You need to use option batch abort (or option batch on) at the beginning of the script.
Actually any example or guide on this site shows this.
See
https://winscp.net/eng/docs/scripting#using_scripting
https://winscp.net/eng/docs/guide_automation
_________________
Martin Prikryl
Socko71
[View user's profile]
Donor
Joined: 2013-03-22
Posts: 19
Location: Indiana
prikryl wrote:
You need to use option batch abort (or option batch on) at the beginning of the script.
Actually any example or guide on this site shows this.
See
https://winscp.net/eng/docs/scripting#using_scripting
https://winscp.net/eng/docs/guide_automation


DOH!!

Actually the script had the options but were commented out....

Thanks...
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