I suspect it does not like nested IFs
I would fake it with GoTos
I wrote the evaluate.vbs script some months ago, under a different screen name.
Anyhow, you are partly right. Use of this parenthetical structure:
IF EXIST "collect_*.TXT" (
blah blah blah
) else (
blah blah blah
)
means that
1. the parentheses in this statement...
echo Wscript.echo eval(WScript.Arguments(0))>"%cd%\evaluate.vbs"
and these...
cscript //nologo "%cd%\evaluate.vbs" "day(date)"
cscript //nologo "%cd%\evaluate.vbs" "month(date)"
cscript //nologo "%cd%\evaluate.vbs" "year(date)"
...need escaping, ^(with carets^) and...
2. without delayed expansion the variables d, m and yyyy will be set to blanks and thus result in "not expected at this time" messages when you do LSS GTR EQU etc comparisons
So the idea of using gotos is a good one.
Here is my version
@echo off
IF not EXIST "collect_*.TXT" goto noinfo
echo Wscript.echo eval(WScript.Arguments(0))>"%cd%\evaluate.vbs"
For /f %%D in ( ' cscript //nologo "%cd%\evaluate.vbs" "day(date)" ' ) do set /a d=%%D
For /f %%M in ( ' cscript //nologo "%cd%\evaluate.vbs" "month(date)" ' ) do set /a m=%%M
For /f %%Y in ( ' cscript //nologo "%cd%\evaluate.vbs" "year(date)" ' ) do set /a yyyy=%%Y
del/q "%cd%\evaluate.vbs"
if %d% LSS 10 (set dd=0%d%) else (set dd=%d%)
if %m% LSS 10 (set mm=0%m%) else (set mm=%m%)
set TimeStamp=%yyyy%-%mm%-%dd
:noinfo
echo.
echo no information collected!
echo.
pause
exit