我有计划在Windows 2012 R2服务器上的任务窗口运行一个.bat
文件执行以下的Windows计划任务继续任务后运行完成
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
这是我SFTP_Download.txt脚本
# 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
在日志文件结束时,我看到该进程完成
< 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
必须看到如何配置任务。但是,而不是最后两个命令,我会改变你如何启动WinSCP:“START”“WinSCP/script =”D:\ AIFiles \ SFTP_Download.txt“' – Squashman
它可能是你需要”exit/b“。只是一个猜测。 –
执行'taskkill'会很危险,因为它会杀死所有'cmd'任务,而不仅仅是这个特定任务。你说“任务仍在运行” - winscp仍在运行,还是winscp停止并退出? – Magoo