Need to call batch file from VB Script

Discussion in 'Scripting' started by Dali, Jan 30, 2004.

  1. Dali

    Dali Guest

    What is the command to call batch file from a vbscript and
    have the batch file executed on the background(so that it
    does not get focus)

    Thanks
    Dali
     
    Dali, Jan 30, 2004
    #1
    1. Advertisements

  2. Dali

    ski Guest

    Review the documentation for the run method.
    Set WshShell = WScript.CreateObject("WScript.Shell)
    WSHShell.run("\\server\folder\setup.bat",7,true)
    Instead of the 7 you could use any of these:
    0 Hides the window and activates another window. 1 Activates and displays a
    window. If the window is minimized or maximized, the system restores it to
    its original size and position. An application should specify this flag when
    displaying the window for the first time. 2 Activates the window and
    displays it as a minimized window. 3 Activates the window and displays it
    as a maximized window. 4 Displays a window in its most recent size and
    position. The active window remains active. 5 Activates the window and
    displays it in its current size and position. 6 Minimizes the specified
    window and activates the next top-level window in the Z order. 7 Displays
    the window as a minimized window. The active window remains active. 8
    Displays the window in its current state. The active window remains active.
    9 Activates and displays the window. If the window is minimized or
    maximized, the system restores it to its original size and position. An
    application should specify this flag when restoring a minimized window. 10
    Sets the show-state based on the state of the program that started the
    application.
     
    ski, Jan 30, 2004
    #2
    1. Advertisements

  3. Dali

    ski Guest

    Typo, should read:

    Set WshShell = WScript.CreateObject("WScript.Shell")

    Forgot the last quotation marks.
     
    ski, Jan 30, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.