winscp script returning error level 1 after successful transfer
Hi,
The following code returns an %ERRORLEBVEL% 1 even though the log files indicate that the script exited with code 0. Why would this be the case?
The following code returns an %ERRORLEBVEL% 1 even though the log files indicate that the script exited with code 0. Why would this be the case?
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\temp\WinSCP.log" /ini=nul /script="C:\temp\winscp.txt -resumesupport" echo %ERRORLEVEL% pause
open ...... lcd F:\AssetWatch\Data cd / put *.xml close exit
> 2019-01-15 19:04:27.747 Script: put *.xml . 2019-01-15 19:04:27.753 Copying 2 files/directories to remote directory "/" - total size: 580,406 . 2019-01-15 19:04:27.753 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: . 2019-01-15 19:04:27.753 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0 . 2019-01-15 19:04:27.753 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml . 2019-01-15 19:04:27.753 Getting real path for '/' > 2019-01-15 19:04:27.753 Type: SSH_FXP_REALPATH, Size: 10, Number: 784 < 2019-01-15 19:04:27.767 Type: SSH_FXP_NAME, Size: 23, Number: 784 . 2019-01-15 19:04:27.767 Real path is '/' . 2019-01-15 19:04:27.767 File: 'testSFTP1.xml' [2019-01-14T08:43:45.555Z] [290203] . 2019-01-15 19:04:27.767 Copying "testSFTP1.xml" to remote directory started. . 2019-01-15 19:04:27.767 Binary transfer mode selected. . 2019-01-15 19:04:27.767 Checking existence of file. > 2019-01-15 19:04:27.767 Type: SSH_FXP_LSTAT, Size: 23, Number: 1031 < 2019-01-15 19:04:27.782 Type: SSH_FXP_STATUS, Size: 33, Number: 1031 < 2019-01-15 19:04:27.782 Status code: 2 . 2019-01-15 19:04:27.782 Checking existence of partially transferred file. > 2019-01-15 19:04:27.782 Type: SSH_FXP_LSTAT, Size: 32, Number: 1287 < 2019-01-15 19:04:27.796 Type: SSH_FXP_STATUS, Size: 33, Number: 1287 < 2019-01-15 19:04:27.796 Status code: 2 . 2019-01-15 19:04:27.797 Opening remote file. > 2019-01-15 19:04:27.797 Type: SSH_FXP_OPEN, Size: 48, Number: 1539 < 2019-01-15 19:04:27.814 Type: SSH_FXP_HANDLE, Size: 10, Number: 1539 > 2019-01-15 19:04:27.814 Type: SSH_FXP_WRITE, Size: 32790, Number: 2054 . 2019-01-15 19:04:27.829 8 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets. > 2019-01-15 19:04:27.829 Type: SSH_FXP_CLOSE, Size: 10, Number: 4356 < 2019-01-15 19:04:27.859 Type: SSH_FXP_STATUS, Size: 21, Number: 2054 < 2019-01-15 19:04:27.859 Status code: 0 < 2019-01-15 19:04:27.873 Type: SSH_FXP_STATUS, Size: 21, Number: 2310 < 2019-01-15 19:04:27.873 Status code: 0 < 2019-01-15 19:04:27.878 Type: SSH_FXP_STATUS, Size: 21, Number: 2566 < 2019-01-15 19:04:27.878 Status code: 0 < 2019-01-15 19:04:27.887 Type: SSH_FXP_STATUS, Size: 21, Number: 2822 < 2019-01-15 19:04:27.887 Status code: 0 < 2019-01-15 19:04:27.892 Type: SSH_FXP_STATUS, Size: 21, Number: 3078 < 2019-01-15 19:04:27.892 Status code: 0 < 2019-01-15 19:04:27.898 Type: SSH_FXP_STATUS, Size: 21, Number: 3334 < 2019-01-15 19:04:27.898 Status code: 0 < 2019-01-15 19:04:27.904 Type: SSH_FXP_STATUS, Size: 21, Number: 3590 < 2019-01-15 19:04:27.904 Status code: 0 < 2019-01-15 19:04:27.910 Type: SSH_FXP_STATUS, Size: 21, Number: 3846 < 2019-01-15 19:04:27.910 Status code: 0 < 2019-01-15 19:04:28.337 Type: SSH_FXP_STATUS, Size: 21, Number: 4102 < 2019-01-15 19:04:28.337 Status code: 0 < 2019-01-15 19:04:28.338 Type: SSH_FXP_STATUS, Size: 21, Number: 4356 < 2019-01-15 19:04:28.338 Status code: 0 > 2019-01-15 19:04:28.338 Type: SSH_FXP_RENAME, Size: 50, Number: 4626 < 2019-01-15 19:04:28.358 Type: SSH_FXP_STATUS, Size: 21, Number: 4626 < 2019-01-15 19:04:28.358 Status code: 0 . 2019-01-15 19:04:28.358 Preserving timestamp [2019-01-14T08:43:45.000Z] > 2019-01-15 19:04:28.358 Type: SSH_FXP_SETSTAT, Size: 35, Number: 1801 < 2019-01-15 19:04:28.373 Type: SSH_FXP_STATUS, Size: 21, Number: 1801 < 2019-01-15 19:04:28.373 Status code: 0 . 2019-01-15 19:04:28.373 Transfer done: 'testSFTP1.xml' => '/testSFTP1.xml' [290203] . 2019-01-15 19:04:28.373 File: 'testSFTP2.xml' [2019-01-14T08:43:45.555Z] [290203] . 2019-01-15 19:04:28.373 Copying "testSFTP2.xml" to remote directory started. . 2019-01-15 19:04:28.373 Binary transfer mode selected. . 2019-01-15 19:04:28.373 Checking existence of file. > 2019-01-15 19:04:28.373 Type: SSH_FXP_LSTAT, Size: 23, Number: 4871 < 2019-01-15 19:04:28.386 Type: SSH_FXP_STATUS, Size: 33, Number: 4871 < 2019-01-15 19:04:28.387 Status code: 2 . 2019-01-15 19:04:28.387 Checking existence of partially transferred file. > 2019-01-15 19:04:28.387 Type: SSH_FXP_LSTAT, Size: 32, Number: 5127 < 2019-01-15 19:04:28.400 Type: SSH_FXP_STATUS, Size: 33, Number: 5127 < 2019-01-15 19:04:28.400 Status code: 2 . 2019-01-15 19:04:28.400 Opening remote file. > 2019-01-15 19:04:28.400 Type: SSH_FXP_OPEN, Size: 48, Number: 5379 < 2019-01-15 19:04:28.419 Type: SSH_FXP_HANDLE, Size: 10, Number: 5379 > 2019-01-15 19:04:28.419 Type: SSH_FXP_WRITE, Size: 35836, Number: 5894 . 2019-01-15 19:04:28.442 9 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets. > 2019-01-15 19:04:28.442 Type: SSH_FXP_CLOSE, Size: 10, Number: 8196 < 2019-01-15 19:04:28.448 Type: SSH_FXP_STATUS, Size: 21, Number: 6150 < 2019-01-15 19:04:28.448 Status code: 0 < 2019-01-15 19:04:28.455 Type: SSH_FXP_STATUS, Size: 21, Number: 6406 < 2019-01-15 19:04:28.455 Status code: 0 < 2019-01-15 19:04:28.461 Type: SSH_FXP_STATUS, Size: 21, Number: 6662 < 2019-01-15 19:04:28.461 Status code: 0 < 2019-01-15 19:04:28.467 Type: SSH_FXP_STATUS, Size: 21, Number: 6918 < 2019-01-15 19:04:28.467 Status code: 0 < 2019-01-15 19:04:28.474 Type: SSH_FXP_STATUS, Size: 21, Number: 7174 < 2019-01-15 19:04:28.474 Status code: 0 < 2019-01-15 19:04:28.480 Type: SSH_FXP_STATUS, Size: 21, Number: 7430 < 2019-01-15 19:04:28.480 Status code: 0 < 2019-01-15 19:04:28.952 Type: SSH_FXP_STATUS, Size: 21, Number: 7686 < 2019-01-15 19:04:28.952 Status code: 0 < 2019-01-15 19:04:28.952 Type: SSH_FXP_STATUS, Size: 21, Number: 7942 < 2019-01-15 19:04:28.953 Status code: 0 < 2019-01-15 19:04:28.953 Type: SSH_FXP_STATUS, Size: 21, Number: 8196 < 2019-01-15 19:04:28.953 Status code: 0 > 2019-01-15 19:04:28.953 Type: SSH_FXP_RENAME, Size: 50, Number: 8466 < 2019-01-15 19:04:28.971 Type: SSH_FXP_STATUS, Size: 21, Number: 8466 < 2019-01-15 19:04:28.971 Status code: 0 . 2019-01-15 19:04:28.971 Preserving timestamp [2019-01-14T08:43:45.000Z] > 2019-01-15 19:04:28.971 Type: SSH_FXP_SETSTAT, Size: 35, Number: 5641 < 2019-01-15 19:04:28.985 Type: SSH_FXP_STATUS, Size: 21, Number: 5641 < 2019-01-15 19:04:28.985 Status code: 0 . 2019-01-15 19:04:28.985 Transfer done: 'testSFTP2.xml' => '/testSFTP2.xml' [290203] . 2019-01-15 19:04:28.985 Copying finished: Transferred: 580,406, Elapsed: 0:00:01, CPS: 467,666/s > 2019-01-15 19:04:28.986 Script: exit . 2019-01-15 19:04:28.986 Script: Exit code: 0 . 2019-01-15 19:04:28.986 Closing connection. . 2019-01-15 19:04:28.986 Sending special code: 12 . 2019-01-15 19:04:28.986 Sent EOF message