New answers tagged


In the FOR command you need escape not only the parenthesis, but the mod (percent) as well. The parens are escaped with ^, the percent by %. Note that this will only work within a batch file, not the command line. FOR /F %%i IN ('powershell ^(new-timespan -start 01/01/2000 -end ^(get-date^)^).days %% 14') DO ( SET doc=%%i ) ECHO %doc%

Top 50 recent answers are included