如果Windowtitle已经存在,则不启动进程

时间:2015-07-08 17:47:07

标签: batch-file

我有一个运行批处理文件的计划任务。我的批处理文件将windowtitle设置为ProcessErrors。此批处理文件可能需要一些时间才能完成,我不希望一次运行多个。我也不想停止已经运行的那个,因为它可能会对进程造成伤害。我想添加一行来检查是否已经打开一个名为“ProcessErrors”的窗口。如果是这样,那么它就不会启动新的,只留下旧的。

1 个答案:

答案 0 :(得分:0)

@echo off
REM list all tasks (verbose) and look for "ProcessErrors". If found, exit
tasklist /v |find "ProcessErrors" && goto :eof
REM else continue here (first set my window title)
title ProcessErrors
REM rest of my batch
相关问题