So i have this code.
FOR /F "tokens=*" %%A IN ('dateFormat +"%Y/%m/%d %T"') DO SET Now=%%A
CALL run_some_job "%Now%"
my output.
JOB_FILE_PATH>FOR /F "tokens=*" %A IN ('dateFormat +"m/T"
') DO SET Now=%A
JOB_FILE_PATH>开发者_Go百科;SET Now=m/T
JOB_FILE_PATH>CALL run_some_job m/T
I use the dateFormat tool from date.exe in this. http://unxutils.sourceforge.net/ to print date. If i do dateFormat +"%Y/%m/%d %T", than it works correctly.
Thanks
You need to escape the percent signs in the date format argument:
FOR /F "tokens=*" %%A IN ('c:\utils\date +"%%Y/%%m/%%d %%T"') DO SET Now=%%A
精彩评论