steveman2292
steveman2292

Reputation: 53

Windows Schedule Task continues to run after task completes

I have a windows scheduled task on a Windows 2012 R2 server that runs a .bat file that executes the following

cd /D "C:\Program Files (x86)\WinSCP"
WinSCP /script="C:\Users\Administrator\AI_SFTP_Download\SFTP_Download.txt" /log="C:\Users\Administrator\AI_SFTP_Download\winscp.log"
exit /b

This is my SFTP_Download.txt script

# Connect
open "xxxxxxxx" -hostkey="xxxxxxxxxxxxx"
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get 211_AI_DR.zip.pgp D:\AIFiles\
# Disconnect
close

At the end of the log file I see that the process is completing

< 2015-12-22 09:47:48.893 Type: SSH_FXP_STATUS, Size: 30, Number: 5771525
. 2015-12-22 09:47:48.893 Preserving timestamp [2015-12-22T09:32:48.000Z]
. 2015-12-22 09:47:48.893 Transfer done: '/Home/Brokers Service Marketing Group/211_AI_DR.zip.pgp' [807259773]
> 2015-12-22 09:47:48.893 Script: close
. 2015-12-22 09:47:48.893 Closing connection.
. 2015-12-22 09:47:48.893 Sending special code: 12
. 2015-12-22 09:47:48.893 Sent EOF message

Upvotes: 0

Views: 2399

Answers (1)

steveman2292
steveman2292

Reputation: 53

Thanks for pointing me in the correct direction everybody, I was able to solved the issue by adding the exit into the SFTP_Download.txt script.

Upvotes: 1

Related Questions