2014-07-09 46 views
0
I have a command file running 24*7 , sometimes , this is stopped and requires 

手動干預以重新啓動命令文件。我可以用其他命令文件(作業)文件監視來做到這一點。如何從其他Command文件重新啓動/啓動Windows命令文件

" IF my .cmd is not running for <5mins , start again ? " , 
    IF so How can this be achieved?  


How can this be done using windows batch file. 



    Algorithm, 

    IF (Test.cmd is not running and sleep_time <(5*60)) 
     { Start Test.cmd } 
+0

你的意思是說,如果你的CMD文件不超過5分鐘運行,則忽略它? – foxidrive

+0

然後再次啓動命令文件(在我的示例「Test.cmd」 – user3094763

+0

這將有助於知道哪個可執行文件正在運行,以便能夠通過任務列表進行檢查。 – foxidrive

回答

0

你可以這樣說:

@echo off 
Set MyProcess=Notepad.exe 

:test 
tasklist | find /i "%MyProcess%">nul && Taskkill /F/IM "%MyProcess%" || start "%MyProcess%" 
timeout 300 /nobreak 
goto:test 
相關問題