Run the batch file from vb application

Posted on 2005-05-11
Last Modified: 2010-05-01
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.

Question by:beeravally
    LVL 13

    Accepted Solution

    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? :)
    LVL 29

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now