I am trying to run this line:
for /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%a
From command line, but got the error:
%%a was unexpected at this time.
Then I searched and found:
The problem is to escape % on batch file I need to add two of them, but on the command line I only need one of it. How can I write it compatible with both command line and batch file keeping it in one and same line of code?