为什么Windows任务调度程序更改日期格式,我该如何解决? [英] Why does windows task scheduler change the date format and how can I fix it?

查看:159
本文介绍了为什么Windows任务调度程序更改日期格式,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大致在后列出了同样的问题:<一href=\"http://stackoverflow.com/questions/7467015/windows-server-2008-r2-date-format-reverts-to-us\">windows服务器2008 R2的日期格式将恢复为美国。

I am having roughly the same problem as outlined in the post: windows server 2008 R2 date format reverts to US.

我有一个创建和智能名的备份文件(FILENAME.Y​​YYY-MM-DD.zip),然后搜索并删除旧的备份超过7天的批处理文件。当我运行在命令行的批处理文件,它会创建备份正确的文件和正确删除旧的,但每当我运行该批处理文件从Windows任务计划任务,使用的是不同的日期格式创建的备份文件因此旧备份永远不会删除,因为他们无法找到。当从任务调度运行的文件名(假设这是今天创建)为FILENAME.Mon11-14-2011.zip被创建。

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?

当我回声%DATE%在命令行输入,日期格式我得到的是YYYY-MM-DD。
我检查我的时钟设置和短期和长期的日期设置为这种格式。

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.

我真的AP preciate任何反馈,因为没有旧的备份删除造成不必要的我去工作,返回到服务器每隔几天,并手动删除旧的备份。

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!

这做到了。考虑下面由注释JDV-简·德·梵的加上我的回应这个问题的答案。

That did it. Consider the comment below by jdv-Jan de Vaan coupled with my response the answer to this question.

推荐答案

难道是因为与用于运行计划任务的帐户关联的区域设置?

Could it be due to a regional setting associated with the account used to run your scheduled task?

这篇关于为什么Windows任务调度程序更改日期格式,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆