Dos batch file - dealing with a nul value
Posted on 2008-06-24
I am using a batch file in windows xp.
I am trying to create a continuous string with date and time stamp in it. I can do it with the following command:
the only catch is that if it is before 10 am it does not attach the time becuse the leading time value is some sort of nul value.
If I can just test to see if it is null and can get around it but nothing seems to work. if %time:~0,1% == nul echo "test" will fail saying "echo was unexpected at this time"
I tried checking to the reverse and it gives me the same error when I check for a 1 or 2.
How can I get around this?