I have a script which basically does the following:
1. Opens a file and reads from it and closes it
2. Runs a select query on a database
3. Starts a loop and runs a .BAT file in a shell window
4. writes to a file
5. Sleeps for 5 mins and does it all again.
I have a couple of problems with this. The first is that while looping the batch files are getting caught up with themselves and not running properly as a result. I need a way of setting it up so that a batch file doesn't run until the previous one is finished. I tried using Wsshell.Exec method and sleeping while the status was zero but it tells me that Exec is not a valid method. I am using Run at the moment and then sleeping but the sleep time is not enough if the PC is under heavy load and too much if the PC is idle. So I need a way to only start a batch file once the previous execution is complete.
Secondly, I need to set this script up to run once the PC has started - regardless of who is logged in. How do I do this and how do I ensure that the PC will have permission to read/write the file and read from the database.
Thanks in advance for any advice.
Can post code if required.
Mighty
1. Opens a file and reads from it and closes it
2. Runs a select query on a database
3. Starts a loop and runs a .BAT file in a shell window
4. writes to a file
5. Sleeps for 5 mins and does it all again.
I have a couple of problems with this. The first is that while looping the batch files are getting caught up with themselves and not running properly as a result. I need a way of setting it up so that a batch file doesn't run until the previous one is finished. I tried using Wsshell.Exec method and sleeping while the status was zero but it tells me that Exec is not a valid method. I am using Run at the moment and then sleeping but the sleep time is not enough if the PC is under heavy load and too much if the PC is idle. So I need a way to only start a batch file once the previous execution is complete.
Secondly, I need to set this script up to run once the PC has started - regardless of who is logged in. How do I do this and how do I ensure that the PC will have permission to read/write the file and read from the database.
Thanks in advance for any advice.
Can post code if required.
Mighty