Windows Server 2008 上的调度作业

发布于 2024-08-01 18:47:26 字数 87 浏览 7 评论 0原文

我有一个文件位于 c:\sample\file.exe。 现在我想每晚执行 file.exe。如何使用批处理文件来实现此目的?

请帮帮我

I have a file located in c:\sample\file.exe. Now i want to execute file.exe every night.How can i achive this using batch file?

Please help me out

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只有影子陪我不离不弃 2024-08-08 18:47:26

在控制面板下,有一个名为“计划任务”的小程序。 这通常是你设置的方式,嗯,又是什么,是的,就是这样,计划任务:-)

如果你真的想从批处理文件而不是漂亮的 GUI 中执行此操作(例如,你正在这样做某些静默安装的一部分),您可以使用 atschtasks。 有关详细信息,请参阅此处,或使用此作为模板:

schtasks
    /create                     # Create a task.
    /tn SampleFile              # This is its name.
    /tr c:\sample\file.exe      # This is the file to run.
    /sc daily                   # Every day.
    /st 23:55                   # At five minutes to midnight.
    /ru User                    # User name to use.
    /rp Password                # Password of that user.

请参阅上述页面以获取更多选项。

Under the Control Panel, there's a applet called Scheduled Tasks. This is usually how you set up, um, what was it again, yes, that's it, scheduled tasks :-)

If you really want to do this from a batch file rather than a nice GUI (e.g., you're doing it as a part of some silent install), you use either at or schtasks. See here for details, or use this as a template:

schtasks
    /create                     # Create a task.
    /tn SampleFile              # This is its name.
    /tr c:\sample\file.exe      # This is the file to run.
    /sc daily                   # Every day.
    /st 23:55                   # At five minutes to midnight.
    /ru User                    # User name to use.
    /rp Password                # Password of that user.

See the afore-mentioned page for even more options.

乖乖兔^ω^ 2024-08-08 18:47:26

将此命令保存在批处理文件中并执行。

%SYSTEMDRIVE% SCHTASKS.EXE /CREATE /SC DAILY /TN "Name of task" /ST 12:00:00 /TR "c:\sample\file.exe" /RU ""

Save this command in batch file and execute it.

%SYSTEMDRIVE% SCHTASKS.EXE /CREATE /SC DAILY /TN "Name of task" /ST 12:00:00 /TR "c:\sample\file.exe" /RU ""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文