Answer the question
In order to leave comments, you need to log in
How to set up a task in the scheduler?
There is a task in the scheduler - when the system starts, run the program and repeat every 3 hours. In the settings is "Do not start new instances" (Do not start new instance). The action looks like:
C:\Windows\System32\cmd.exe /C start /WAIT /AFFINITY 2 C:\Scripts\Parser.exe
Answer the question
In order to leave comments, you need to log in
In the first line of the batch file, add:
taskkill /f /im parser.exe
If this mechanism does not work, then write the simplest batch file that you insert into the task.
The batch file does the following:
1. checks for the presence of a flag file (any empty file, in any available directory), if the file exists, the task is already running, exit.
2. creating a flag file
3. launching parser.exe
4. deleting the flag file The
downside is that there may be situations when there is no task, and the flag file remains not deleted. In such cases, you will have to delete it manually ...
Another option is to check the presence of a running parser.exe process in the batch file, if there is no process, then start it. You can check processes with tasklist /?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question