Tuesday, 3 December 2019

Schedule Jobs through command prompt

@echo off
setlocal enabledelayedexpansion
set numberofthreads=1
set iterationcount=5000
set stophour=22
set stopmin=40
echo Starting All
echo %time%
for /l %%x in (1, 1, %iterationcount%) do (
    Echo Success %%x %%x %%x %%x %%x %%x %%x %%x
    set currTime=!time!
    set currhour=!currTime:~0,2!
    set currmin=!currTime:~3,2!
    echo !time!
    if !currhour! EQU !stophour! (
    if !currmin! GEQ !stopmin! (
    echo "Stop 1 "
    goto :eof
        )
    )
    for /l %%x in (1, 1, %numberofthreads%) do (
        start "" "E:\BatchJobs\BatchFile.bat"
        timeout 5 > NUL
    )
    echo[
    Echo ------
    echo[
    timeout 55 > NUL
)

In Batch process

  • Start - Will create new command prompt and run
  • Call - will Use the same window to execute