%TIME% environment variables provide the current date and time on Windows machines on the command line and inside a batch file.
Sadly, those values are locale-aware! Meaning that, say, on a German machine, you will get
this screws up sorting if you want to use this variable in a file name.
Is there any easy way to get hold of a locale-unaware
YYYY-MM-DD date string in a Windows batch file?
For the moment, I am working with this rather kludgy workaround:
for /f "tokens=1,2,3,4 delims=. " %%i in ('date /t') do set date=%%k-%%j-%%i echo %date%
but this is now German locale specific - obviously, a completely independent solution would be much nicer.
The OS in question is Server 2008. I would much prefer not using a third party tool, if at all possible.