Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


JRaker
2018-01-03T19:58:58Z
Hi everyone,

I have a bunch of .bat files I need to execute daily. This list is dynamic and will change from day to day. Some may get added, others may drop off.

I may have thousands of these and I would rather not have to schedule them and maintain that schedule for each of these individually.

I was thinking of storing the current list in a single column database table and reading its contents. With the results, I would grab the first row, set its value as a variable that represents a file path and file name, run that .bat file, move to the next row and repeat until the end of the list.

For example, imagine the following table:

SELECT * FROM table;


Column 1

ABC123

DEF456

GHI789


I want to then take this result and do the following:

Run: "C:\ABC123\ABC123.bat"

Run: "C:\DEF456\DEF456.bat"

Run: "C:\GHI789\GHI789.bat"


Is it possible to create a loop, read these values and pass them to a file path variable?

Thank you in advance!

Jordan
Sponsor
Forum information
ErikC
2018-01-04T07:43:03Z
Hi Jordan, welcome te the forum!

Yes you can do this with two tasks. 1st is the SQL query having all the names in one column in the resultset. 2nd Is the Execute task. at this task you need to create a loop having the output from the 1st task as the input for the For each x in y loop. Than in your execute task, you can use the following path: C:\{LOOP(CurrentValueX)}\{LOOP(CurrentValueX)}.bat

Regards,
Erik
Uses Visualcron since 2006.
Scroll to Top