Need c# windows service program to execute a batch file at a specific time on winserver 2003

Hi
If someone has a link to a site that will show me how to write a  c# windows service program to execute a  cmd line .bat batch file at a specific time on windows server 2003?

What I have is a simple .bat file that does a xcopy backup for me. Does the job well. I want to execute it every day at 2am. I was thinking of writing a c# windows service to do it. vb is ok as well. If anyone has a better idea I am interetsed as well.

Thanks
Charles BaldoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jgordosCommented:
You can use the .net function "shell()"...

There are some wrapper classes available (freeware) on the net to wrap this all up in a pretty little bow for you.

http://www.developerdotstar.com/community/node/280

-john
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CoyotesITCommented:
Here is a site with a tutorial on creating a c# service app, along with passing a parameter to it. I would recommend you use a parameter for the time you want this to run the batch file.

http://www.c-sharpcorner.com/UploadFile/ankithakur/Passing_parameters_to_Windows_Services10062006000204AM/Passing_parameters_to_Windows_Services.aspx


once the service is installed and running with the configured parameter (time of day you want this process to run) then run the file if the current time equals your parameter i.e. 02:00

using System.Diagnostics.Process.Start("c:\\winnt\\notepad.exe");


0
CoyotesITCommented:
can i ask why you dont just use a scheduled task?
0
Charles BaldoSoftware DeveloperAuthor Commented:
Thanks both,

In answer to CoyotesIT. Because I didn't think of it Will look into it. Thast some of the exact feed back I was hoping for.   Also I wanted to learn to write a service. This is as much a learning task, hobby task as a business task.

Thanks to both
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.