Going nuts with escaping! Trying to apply the "trick"
for /f "delims=" %%a in ('command') do @set theValue=%%a
(found at Set the value of a variable with the result of a command in a Windows batch file) to assign the result of a command to an environment variable.
But when the command needs to contain single quotes - in my example: date '+%s'
(to obtain the time in seconds) - how can I escape the single quotes inside a single quoted string?
I tried with doubling them ''
and prefixing with \
but neither worked. Also using double quotes around command (i.e. "date '+%s'"
) did not work... :-(