批处理文件 - 每20分钟后重启程序

mm1*_*985 13 batch-file

我想创建启动程序的批处理文件,20分钟后将关闭程序并重新启动它.

我对批处理文件的唯一了解是如何启动程序:

@echo off
Start [adress of application]
Run Code Online (Sandbox Code Playgroud)

Ian*_*Ian 14

这有效:

@echo off                           //Turn off screen text messages
:loop                               //Set marker called loop, to return to
start "Wicked_Article_Creator" "C:\Wicked Article Creator\Wicked Article Creator.exe"  //Start program, with title and program path 
timeout /t 1200 >null               //Wait 20 minutes
taskkill /f /im "Image Name" >nul   //Image name, e.g. WickedArticleCreator.exe, can be found via Task Manager > Processes Tab > Image Name column (look for your program)
timeout /t 7 >null                  //Wait 7 seconds to give your prgram time to close fully - (optional)
goto loop                           //Return to loop marker
Run Code Online (Sandbox Code Playgroud)


Mag*_*goo 6

@echo off
:loop
start yourtarget.exe ...
timeout /t 1200 >null
taskkill /f /im yourtarget.exe >nul
goto loop
Run Code Online (Sandbox Code Playgroud)

应该做的工作.