如何在指定的日期/时间运行bat文件? [英] How to run a bat file at specified day/time?

查看:932
本文介绍了如何在指定的日期/时间运行bat文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bat文件,希望在一年中的每个季度的特定日期/时间运行. 我是命令行的新手,我知道如何通过任务计划程序运行它,这非常容易.

I have a bat file that I want to run at specific day/time in each quarter for a year. I m new to command line and I know how to run it via a task scheduler, which is very easy.

让我们说在第一个月和第二个月的每个季度,我的蝙蝠档案都应该在其他星期运行.对于季度的第三个月,它应该每周运行一次.可能的时间是凌晨6:00,我该怎么办?请告诉我.谢谢.

Let's say for each quarter, for 1st and 2nd month, my bat file should run at alternative weeks. For the third month of a quarter, it should run weekly. Possible time would be early morning 6:00 a.m. How would I do it? Please let me know. Thanks.

推荐答案

There's the windows scheduler, but I doubt you are going to be able to do a schedule that advanced with just the windows scheduler.

我要做的是用某种高级语言(C#,JAVA等)编写调度逻辑(例如,当您希望运行批处理文件时),然后在批处理文件的开头调用该程序以查看如果这是您关心的日期.

What I would do is write the scheduling logic (e.g. when you want your batch file to run) in some high level language (C#, JAVA, etc.), then call that program at the beginning of your batch file to see if it's a date you care about.

可以使用Windows计划程序将批处理文件设置为每天运行(如果需要,则每天运行多次),但是只有在您的C#/JAVA程序指示它是一个日期时,它才会执行实际工作"你很在意.

The batch file could be set up to run each day (or multiple times per day if needed) using the windows scheduler, but it would only do the "real stuff" if your C#/JAVA program indicated that it was a date you cared about.

这篇关于如何在指定的日期/时间运行bat文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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