Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 432
  • 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
 
S00007359Commented:
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
Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

 
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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