Run the batch file from vb application

how to run the batch file from vb application.and i want to run that batch file every one hour(i.e,12:01,01:01,02:01.....)from vb itself.i always open that vb application in run help me any one.

Who is Participating?
softplusConnect With a Mentor Commented:
you're running the vb app full time, correct?
I'd do the following (pseudocode :)):
global dtmLastRunTime as Date
add a Timer object to the main form, set the interval to something like 60000 (1 minute)
In the Timer event:
  if now > DateAdd("h", 1, dtmLastRunTime) then
     Call DoBatch
     dtmLastRunTime = Now
   End If

then in the DoBatch:
  Call Shell(BatchFileName)

This way you're program isn't hogging resources while waiting, it checks every minute to see if the one hour is up and then runs the batch file. The first run will be when you activate the Timer.

Sound good? :)
I would suggest writing everything is visual basics instead of using a batch file, since you are already going to be using visual basic just to launch the batch file, why not implement what the batch file does into your vb app instead.
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.

All Courses

From novice to tech pro — start learning today.