Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: Winscp batch file won't close/exit upon completion despite having attempted using both commands

You are missing ^ at the end of the line with synchronize command.
kristinebollinger

Winscp batch file won't close/exit upon completion despite having attempted using both commands

When I click on batch file it runs and ends at
>winscp
I would like the window to close. Here is the code (xxxxxxxxxxx for security replacement).

@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Users\xxxxxxxxxxxx\Desktop\WinSCP.log" /ini=nul ^
/command ^
"open sftp://xxxxxxxxxxxx.com/ -hostkey=""ssh-rsa 2048 9e:c2:dd:6d:86:a6:30:56:9d:ea:99:de:ff:c3:5f:2d"" -rawsettings FSProtocol=2 ProxyMethod=3 ProxyHost=""xxxxxxxxxxxx"" ProxyPort=xxxxxxxxxxxx ProxyUsername=""xxxxxxxxxxxx"" ProxyPassword=""xxxxxxxxxxxx""" ^
"synchronize local K:\test /outbound/ylx"
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%