问题
I am having roughly the same problem as outlined in the post: windows server 2008 R2 date format reverts to US.
I have a batch file that creates and smart names backup files (FILENAME.YYYY-MM-DD.zip) then searches for and deletes old backups more than 7 days old. When I run the batch file from the command line, it creates the backup files properly and deletes the old ones properly, but whenever I run the batch file as a task from the windows task scheduler, the backup files are created using a different date format and thus old backups never get deleted because they cannot be found. When run from the task scheduler the file name (let's say it was created today) is created as FILENAME.Mon11-14-2011.zip.
I have checked all of the date, time, region, locale settings. I have no idea where the task scheduler is getting the date format that it is using. Why is it changing?
When I type in echo %date% from the command line, the date format I get is YYYY-MM-DD. I have checked my clock settings and both short and long date are set to this format.
I would really appreciate any feedback as not having the old backups delete is causing me undue work going back into the server every couple of days and manually deleting the old backups.
ANSWERED!!!
That did it. Consider the comment below by jdv-Jan de Vaan coupled with my response the answer to this question.
回答1:
Could it be due to a regional setting associated with the account used to run your scheduled task?
来源:https://stackoverflow.com/questions/8127335/why-does-windows-task-scheduler-change-the-date-format-and-how-can-i-fix-it