Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need batch run during business hours

Status
Not open for further replies.

deh

Technical User
May 13, 2002
48
US
HI,
I am trying to figure the best way to do this:

I need to run a command every 30 minutes on an NT server from 8am - 7pm. And then every 2 hours on the weekend. I have a batch that when called will run the command and then run again every x minutes.
With scheduler I can run an AT command which I am sure will start off the whole process. So I am trying to decide if I should do an Every with the AT command (the problem with this would be I would have ALOT of commands which I don't) or use the AT command to run a batch containing the command which will run itself every 30 minutes. The problem with the latter is it would never stop though unless I can figure a way to cut it off with another AT command somehow or a command within the batch itself (maybe a For/If? I know there is an IF and string comparison I can run so then I could check value of X if X doesn't equal 24 it runs the exe but if it does then the batch must exit; I know the syntax in typical program language but not sure how to do it exactly in batch-do I need to declare vars or strings, anyone have syntax on that I can include in my batch? So in a nutshell I need to have the exact syntax on how to do this in a batch command.)

Any suggestions, examples or even a better way to accomplish this would be appreciated.

Thanks,
Dan
 
I've always used the old AT command. Or, it's GUI companion, WinAT.

Type AT /? at a command prompt for help.

HTH, MapMan [americanflag]

Assume nothing, question everything, be explicit not implicit, and you'll always be covered.
 
Thanks for the response. With this though it appears my AT command lines will be very long. I was thinking more the line to run a batch. This would result in 1 AT command per day rather than 24 AT commands per day X 5 days per week. I found something like this to run 30 times but I think the first if statement is wrong right from the beginning:

set count1=| set count2=
:loop
set count1=%count1%-
command.exe
if not "%count2%%count1%"=="+++----" %then% goto end
%else% if not "%count1%"=="----" %then% goto loop
%else% set count2=%count2%+| set count1=
goto loop


Unless I am mistaken (corrections gladly welcome) wouldn't the first pass through cause this to GOTO END. Count1 would = - so the first time it goes through "%count2%%count1" would = - so the statement would not be true causing an END, right?
So as I said unless I am looking at this wrong the concept is there but it needs some tweaking. Also end would indeed end the batch correct.

Thanks,
Dan

 
Sorry for the add on but I may not be able to through a parameter in the exe and have the counter in place to be valid, so on top of this I will need a Wait command or yet another nested loop that would count out to 30 minutes.

Dan
 
Have a look at
They have a free scheduling package on there. I have just used it for scheduling backups overnight. It's a lot easier than playing with scheduler

TTFN

T
 
Thanks but I really didn't want to use the scheduler in this way. I have no problems whatsoever in the syntax of using it (I use it for many things including backup, FTP, etc) I was just wondering how to do it with a Batch script as I stated.

Regards,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top