I have a strange issue in a batch file. My script is just as in the documentation:
setlocal set TIMESTAMP_FORMAT=yyyy-mm-dd for /F "tokens=* USEBACKQ" %%F in ( `winscp.com /command "echo %%TIMESTAMP#%TIMESTAMP_FORMAT%%%" "exit"` ) do set TIMESTAMP=%%F echo %TIMESTAMP% endlocal
Instead it returns two more readings - "Exit code: 0" and "Max roundtrip: 0".
Here is the result:
D:\test>setlocal D:\test>set TIMESTAMP_FORMAT=yyyy-mm-dd D:\test>for /F "tokens=* USEBACKQ" %F in (`winscp.com /command "echo %TIMESTAMP#yyyy-mm-dd%" "exit"`) do set TIMESTAMP=%F D:\test>set TIMESTAMP=2021-01-19 D:\test>set TIMESTAMP=Exit code: 0 D:\test>set TIMESTAMP=Max roundtrip: 0 D:\test>echo Max roundtrip: 0 Max roundtrip: 0 D:\test>endlocal
My system is Windows 8.1 64-bit and the WinSCP version is 5.17.9 (Build 10905).
Any help is welcome.
I've got it.
I've used logging for a while and then disabled it. It seems the console still generate some log regardless of the checkbox condition ("Enable session logging on level:"), when the dropdown box is set to "Debug 1" or "Debug 2" (even if it is greyout).
So, I had to set the option to "Reduced" (or "Normal") and the problem is gone.