Error Code always 0
I have a simple script that transfers files no issues but success or failure it shows as success. Would appreciate any guidance.
The batch file:
Here's the output with 0 files in the local dir:
The batch file:
@echo off "D:\temp\WinSCP\WinSCP.com" ^ /log="D:\temp\winscp\WinSCP.log" /ini=nul ^ /command ^ "open sftp://CM111XXXSI:XxXXxXXX@QAFILEXMIT:10088/ -hostkey=""ssh-rsa 2048 *****************************************"" -privatekey=""D:\certificate\e*********.ppk"" -passphrase=""***********"" -rawsettings AuthKI=0 GSSAPIFwdTGT=1 KEX=""rsa,ecdh,dh-gex-sha1,dh-group14-sha1,WARN,dh-group1-sha1""" ^ "put -nopreservetime -nopermissions D:\aews\maintenance.application\export\*.fil" ^ "ECHO ERRORLEVEL %ERRORLEVEL%" ^ "exit" set WINSCP_RESULT=%ERRORLEVEL% if %WINSCP_RESULT% equ 0 ( echo Success ) else ( echo Error ) exit /b %WINSCP_RESULT%
Here's the output with 0 files in the local dir:
d:\escrow\jobs>filetransfer Searching for host... Connecting to host... Authenticating... Using username "CM111XXXSI". Authenticating with public key "*******". Further authentication required Authenticating with pre-entered password. Authenticated. Starting the session... Session started. Active session: [1] CM111XXXSI@********* No file matching '*.fil' found. ERRORLEVEL 0 Success