[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

Run the batch file from vb application

hi,
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 mode.how?pls help me any one.

chandu
0
beeravally
Asked:
beeravally
1 Solution
 
softplusCommented:
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? :)
0
 
nffvrxqgrcfqvvcCommented:
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

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