如何在 Windows Server 2003 中通过批处理脚本检查进程是否正在运行
我想使用批处理文件来检查进程是否在 Windows Server 2003 上运行,如果没有则启动一个新实例。
这与
但对于 Windows Server 2003。答案略有不同,但我没有足够的代表来回答这个问题,因此我将其发布到此处以供将来搜索。
..坝。我需要等8个小时。答案即将到来。
I want use a batch file to check if a process is running on Windows Server 2003 and then start a new instance if not.
This is the same question as
How to check if a process is running via a batch script
but for Windows Server 2003. The answer is slightly different, however I don't have enough rep to answer that one so I'll post it here for future searches.
..dam. I need to wait 8 hours. Answer coming soon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接中提供的答案适用于 XP,但在 Windows Server 2003 中,该行
返回“信息:没有正在运行与指定条件匹配的任务”。然后在进程运行时读取它。
我没有大量的批处理脚本编写经验,因此我的解决方案是在 search.log 中搜索进程名称,并将结果放入另一个文件中,然后在该文件中搜索任何输出。
希望这对其他人有帮助,如果我得到足够的代表,我会将其添加到原始问题的答案中。
本
The answer provided in the link works for XP, however in Windows Server 2003 the line
returns "INFO: No tasks are running which match the specified criteria." which is then read as the process is running.
I don't have a heap of batch scripting experience so my soulution is to then search for the process name in search.log and pump the results into another file and search that for any output.
Hope this helps someone else, if I get enough rep I'll add it to the original question's answers.
Ben