1

I have a WinSCP command in a batch file as described below:

get -neweronly event_%TIMESTAMP#yyyymmdd%_0000.db C:\events\test

What I want to do is set the TIMESTAMP from a user input (e.g. from a text file) I do not want to use the current computer time - Is this possible?

If I put a date of 20180101 in a text file and import it, would this be the solution?

set /p TIMESTAMP=<Timestampdate.txt

Would I need to do anything to the TIMESTAMP in the get -neweronly event_%TIMESTAMP#yyyymmdd%_0000.db C:\events\test?

1 Answer 1

1

If you want to use an environment variable in WinSCP script, use syntax %NAME%. The #yyyymmdd part cannot be there, nor does it make any sense.

And while WinSCP will not override an existing TIMESTAMP variable with its own value, it's definitely better to use a different name, to avoid ambiguity. After all, your variable is just a generic environment variable, it has nothing to with WinSCP TIMESTAMP syntax.

In batch file:

set /p MYTIMESTAMP=<Timestampdate.txt  

In WinSCP script:

get -neweronly event_%MYTIMESTAMP%_0000.db C:\events\test
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.