WinSCP won't be started on server using script
Hi,
We want to run WinSCP on Windows server 2016 twice a day for downloading reports from FTP site. We created a task scheduler(See the screenshot I uploaded) for the automation and confirmed the task was triggered successfully. However, it didn't call up WinSCP. The weird thing is I was able to run it manually in command prompt, but when I used task scheduler if wouldn't work.. Can someone please help?
The batch file is below
cd E:\Shares\FTP\
mkdir %date:~-10,2%"-"%date:~7,2%"-"%date:~-4,4%
cd C:\Program Files (x86)\WinSCP\
Winscp.com /ini=nul /script=dlscript.txt /log=ftpdownload.txt
exit
The script is below:
open sftp://pbuevh01:Apiscap90!@sfx.gs.com/ -hostkey="ssh-dss 1024 92:69:0e:64:a2:04:92:a4:49:17:3c:5c:e0:1b:59:93"
# Change remote directory
cd /outgoing
# Force binary mode transfer
option transfer binary
# Download file to the local directory E:\Shares\FTP\
#cd E:\Shares\FTP\%TIMESTAMP#mm-dd-yyyy%\
mget *.* E:\Shares\FTP\%TIMESTAMP#mm-dd-yyyy%\
# Disconnect
close
exit
We want to run WinSCP on Windows server 2016 twice a day for downloading reports from FTP site. We created a task scheduler(See the screenshot I uploaded) for the automation and confirmed the task was triggered successfully. However, it didn't call up WinSCP. The weird thing is I was able to run it manually in command prompt, but when I used task scheduler if wouldn't work.. Can someone please help?
The batch file is below
cd E:\Shares\FTP\
mkdir %date:~-10,2%"-"%date:~7,2%"-"%date:~-4,4%
cd C:\Program Files (x86)\WinSCP\
Winscp.com /ini=nul /script=dlscript.txt /log=ftpdownload.txt
exit
The script is below:
open sftp://pbuevh01:Apiscap90!@sfx.gs.com/ -hostkey="ssh-dss 1024 92:69:0e:64:a2:04:92:a4:49:17:3c:5c:e0:1b:59:93"
# Change remote directory
cd /outgoing
# Force binary mode transfer
option transfer binary
# Download file to the local directory E:\Shares\FTP\
#cd E:\Shares\FTP\%TIMESTAMP#mm-dd-yyyy%\
mget *.* E:\Shares\FTP\%TIMESTAMP#mm-dd-yyyy%\
# Disconnect
close
exit