Post a reply

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

panevdd

Strange output from the Timestamp Formatting

Hi,
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

It should return the current date: 2021-01-19.
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

I used this code before and I see such behavior for the first time.
My system is Windows 8.1 64-bit and the WinSCP version is 5.17.9 (Build 10905).
Any help is welcome.
Thank you!

Update:
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.