在 win 7 任务调度程序中按顺序运行批处理文件 [英] Running batch files sequentially in win 7 task scheduler

查看:58
本文介绍了在 win 7 任务调度程序中按顺序运行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 2 个批处理文件作为单个任务中的操作".第一个使用 microsoft security Essentials 对病毒进行扫描.第二个使计算机进入睡眠状态.问题是任务运行的时候,好像两个批处理文件同时运行,也就是说,我可以看到病毒扫描的开始,但是计算机几乎立即进入睡眠状态,所以扫描真的没有机会开始.我知道批处理文件将在任务调度程序中按顺序运行.我错了吗?如何让睡眠批处理文件等待扫描批处理文件完成?这是 2 个简单的批处理文件...

I have 2 batch files as "actions" in a single task. The first one does a scan for viruses using microsoft security essentials. The second one puts the computer to sleep. The problem is that when the task is run, it seems like both batch files run simultaneously, that is, I can see the start of the virus scan, but then the computer goes to sleep almost immediately, so the scan really never has a chance to start. I understood that batch files would run in sequential order in the task scheduler. Am I wrong? How do I make the sleep batch file wait until the scan batch file has completed? Here are the 2 simple batch files...

批处理文件一

"C:\Program Files\Microsoft Security Essentials\MpCmdRun.exe" -scan -scantype 1

"C:\Program Files\Microsoft Security Essentials\MpCmdRun.exe" -scan -scantype 1

批处理文件二

powercfg -h 关闭

powercfg -h off

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

powercfg -h 开启

powercfg -h on

推荐答案

可以使用适用于 Windows 7、Windows Server 2008 R2、Windows Server 2012、Windows Vista 的 Windows 计划任务.

It's possible using Windows Scheduled Tasks for Windows 7, Windows Server 2008 R2, Windows Server 2012, Windows Vista.

来自 Microsoft 文档:

From Microsoft documentation:

任务操作是在任务运行时执行的工作.一个任务可以有一个动作或最多 32 个动作.每个操作都包含确定操作执行方式的设置.任务的操作显示在任务属性"或创建任务"对话框的操作"选项卡上.当指定多个动作时,它们按顺序执行从动作选项卡中列表顶部的动作开始...

A task action is the work that is performed when the task is run. A task can have a single action or a maximum of 32 actions. Each action contains settings that determine how the action is performed. A task's actions are displayed on the Actions tab of the Task Properties or Create Task dialog box. When multiple actions are specified, they are executed in sequential order starting with the action at the top of the list in the Actions tab...

这篇关于在 win 7 任务调度程序中按顺序运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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