Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Renat

Can't exit WinsCP once script complete

This script cut and paste files from a folder on FTP server. This is works, but from some reason, after running the section is not closed and I need to rate manually exit.
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\\exlibris.log" /ini=nul ^
  /command ^
    "open sftp://**********:10022/ -hostkey=""ssh-rsa 4096 upqTBzuxy+fGrA4+dFQaWXmIq7/E1CwyAjqRSwq9eQo"" -privatekey=""C:\test\test.ppk"" -rawsettings AgentFwd=1 ProxyPort=1" ^
    "get -delete /test/* C:\test\" ^
   
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%