@echo off :: https://superuser.com/questions/1332308/how-can-i-call-a-batch-file-within-another-batch-file "C:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="C:\Test\TestLog.log" /ini=nul ^ /command ^ "open sftp://test/ -hostkey=""ssh-dss 2048 xxxxxxxxxxxxxxxxxxxxxxxxx=""" ^ "synchronize remote \\Please\Send\Some\Help /Dir/Test" ^ "exit" set WINSCP_RESULT=%ERRORLEVEL% if %WINSCP_RESULT% equ 0 ( echo Success ) else ( echo Error ) CALL movefile pause exit /b %WINSCP_RESULT%