I have a vb.net console application. That needs to be run in every 5 min. How to wire a batch file to call that exe file and execute in every 5min. Like an agent.
As suggested, I have written a .bat file like this and saved it as a .bat file and put in my bin folder
%~dp0MyconsoleApp>>%~dp0MyconsoleApp_Log.txt
I have created a windows task scheduler that can execute this for every 5 min.
Now, My question is How to stop this service... (i am using ctrl+c) What is the best way to start and stop the service...(programatically or manually)
If it has to be a batch:
:start
echo put your file to execute here
echo five minutes break
TIMEOUT /T 300 /NOBREAK
echo I'm back
goto start
But like Bill said, the Task Scheduler may be sufficient.
Why not write another VB.net program with a timer and a NotifyIcon. Have the timer start the console application every 5 min, and have a right click option on the NotifyIcon to start/stop manually.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.