Script crashes before 10 a.m.
So what exactly went wrong? Our Windows batch script uses the current date and time to compose a file name, which is then passed as an argument to a Java application. So far so good. But why does it fail before 10 a.m? Let’s see how Windows handles dates and times:
We get a leading zero for days and a space for one-digit hours! This explains why our script failed:
So we just replace leading spaces with zeros, right? Nope. The time/date format is country-dependant and can be fully customized… We are supposed to use something like this instead:
This pretty much sums it up:
“It’s a complete nightmare for a BAT programmer.”