Re: How to create directory and move to this new directory
The simplest solution is just repeat
If you want to be 100% sure, you can query the timestamp before starting the actual script (based on Formatting Timestamp in Batch File):
And then in the
Alternatively, instead of environment variable, you can use script argument.
%TIMESTAMP#yyyy-mm-dd-hh%
. I understand that there's a small risk that "hour" changes between the two lines.
If you want to be 100% sure, you can query the timestamp before starting the actual script (based on Formatting Timestamp in Batch File):
for /F "tokens=* USEBACKQ" %%F in (
`winscp.com /command "echo %%TIMESTAMP#yyyy-mm-dd-hh%%" "exit"`
) do set THE_TIMESTAMP=%%F
winscp.com /script=script.txt
And then in the
script.txt
WinSCP script, you can use %THE_TIMESTAMP%
environment variable repeatedly.
Alternatively, instead of environment variable, you can use script argument.