First of all I am running this under XP or 2003 so I don't know if that changes much. I have a bat file that is sensitive to certain environment variables in the time and date and I want to find a way to check for that so I did something like this:
Problem is that won't work for whatever reason even though the date is returned in this fashion "YYYY.MM.DD" which is what I need as I am using it in a file name so this is perfect for me.
I do know that if I do this it will work fine:
I thought that I could use a "?" to replace a single character and a "*" for multiple characters but that doesn't seem to work at all.
Code:
For /f "tokens=2,3,4 delims=/ " %%i in ('date /t') do (set DATE=%%k.%%i.%%j)
IF ????.??.?? == %DATE% echo ALL GOOD
Problem is that won't work for whatever reason even though the date is returned in this fashion "YYYY.MM.DD" which is what I need as I am using it in a file name so this is perfect for me.
I do know that if I do this it will work fine:
Code:
For /f "tokens=2,3,4 delims=/ " %%i in ('date /t') do (set DATE=%%k.%%i.%%j)
IF 2006.12.11 == %DATE% echo ALL GOOD
I thought that I could use a "?" to replace a single character and a "*" for multiple characters but that doesn't seem to work at all.