• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

Batch Script

I like to write a  window batch script that will run  after every hour.
Suppose the name of my batch script is : st.bat,  and script  is in my machine's C:\ drive
0
zeinth
Asked:
zeinth
2 Solutions
 
S00007359Cloud Engineering OfficerCommented:
1) What is the script intended to do, i mean what do you want to acheive
2) once the script is complete, you can use the windows scheduler to  to run the script every hour.

Thanks
S00007359
0
 
zeinthAuthor Commented:
I doubt that through window scheduler  tool we can run script for every hour for Indefinite period.
.
0
 
Mechanic_KharkovCommented:
Windows scheduler is intented Exactly for Your task. And it has all needed options to precise control over the job execution time. It's true,  just try.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
chatxfalconCommented:
Zeinth,

You can run multiple schedule or set it on hourly basis.

You can find more info at:

http://www.iopus.com/guides/winscheduler.htm

http://support.microsoft.com/kb/308569


I hope this helps

0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
You can doubt it, but I've run a script every 5 minutes for the last 2 years on one server - it updates MRTG to show a graph of my internet throughput.  I use Scheduled Tasks.  And it's still running.  Is that "indefinite" enough?
0
 
t0t0Commented:
I agree with Mechanic_Kharkov.


1) Head over to control panel - Start | Settings | Control Panel
2) Run Scheduled Tasks by double-clicking it
3) Using Windows Explorer, locate your batch file and drag-&-drop it from Explorer to the Scheduled Tasks' pane.
4) In Scheduled Tasks, double-click your batch file task to edit it's properties.
5) Under the Tasks tab, verify Run As points to the correct user and then Set the password.
6) Under the Schedule tab, click Advanced, tick Repeat TAsk, set Every to 10 minutes and click OK
7) click Apply. Type in a password if you are prompted for one and click OK twice.

This should set your batch file to run every 10 minutes.
0
 
zeinthAuthor Commented:
I got below solution from net, I think this script will work for me:
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr \\central\data\scripts\task.bat
thanks all
0
 
t0t0Commented:
If you have a solution, you may close this question. You can acceppt your own comment as your solution if that's the case.
0
 
t0t0Commented:
Thank you.

Kind regards.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now