Home:ALL Converter>How to schedule running a bat file not using Windows Task Scheduler?

How to schedule running a bat file not using Windows Task Scheduler?

Ask Time:2017-12-18T09:51:07         Author:alextc

Json Formatter

I have a batch (*.bat) file that triggers a Python script and this script takes about 25 minutes to complete interactivly (through command prompt manuallly). This batch file needs to run in the morning on a daily basis.

When I tried to set it as a Scheduled Task on Windows Task Scheduler and ran it there, it took nearly double the time than it did interactively. Even if I set the Priority settings from the default 7 to 4 (higher priority) in the xml, it didn't make any differnce. Changing the Priority settings only works for I/O Priority but does not work for Memory Priority, which still remains at 4 (1 level down the interactive run which is 5). Memory Priority plays an important role in supporting a long process.

I am wondering if there is a way to trigger the bat file as a scheduled task but not using Task Scheduler, alternative program to Task Scheduler or scripts?

Author:alextc,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/47861172/how-to-schedule-running-a-bat-file-not-using-windows-task-scheduler
Ed Eastman :

As the above has no exit strategy and is delayed for at least 25 minutes, this batch file code may be better suited to your need, drop a reference into your login batch or other trigger...\n@echo off\n:loop\nset timeHrs=%time:~0,2%\nset timeMin=%time:~3,2%\nset timeSec=%time:~6,2%\n\nif "%timeHrs%" geq 6 if "%timeHrs%" leq 9 (\n [command to trigger Python script]\n exit /b 0\n)\n\ntimeout /t 1500\ngoto loop\n",
2020-12-22T14:42:44
an tran huu :

'Timeout' might a good command to schedule your task without Task Scheduler. \n\ntimeout /t 1500\n[command to trigger Python script]\n\n\nSo you want 'This batch file needs to run in the morning...', you can set the start time and end time as well:\n\nset timeHrs=%time:~0,2%\nset timeMin=%time:~3,2%\nset timeSec=%time:~6,2%\n\n[insert timeout command]\n\nif \"%timeHrs%\" geq 6 if \"%timeHrs%\" leq 9 [command to trigger Python script]\nrem The above command is check if Hour is in 6-9 (in morning).\n\n\nIf you want then you can copy code below (you might have to edit code as well):\n\n@echo off\n:loop\nset timeHrs=%time:~0,2%\nset timeMin=%time:~3,2%\nset timeSec=%time:~6,2%\n\ntimeout /t 1500\n\nif \"%timeHrs%\" geq 6 if \"%timeHrs%\" leq 9 [command to trigger Python script]\ngoto loop\n\n\nYou also want to add the exit in code as well, but I think you don't need it, just let the code run everyday.",
2017-12-31T03:52:10
yy