Results 1 to 3 of 3

Thread: Batch File

  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there a way for the batch file code to wait until a call to SHELL has been completed?

    Example Code:
    Run 1st line of code
    Call Shell("D:\BatchFiles\MyBatchFile.Bat", vbNormalFocus)
    ' want to wait here until the MyBatchFile.Bat has been fully executed
    Run 3rd line of code


    Thansk,
    John

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,414
    Thanks
    33
    Thanked 195 Times in 175 Posts
    [quote name='jstevens' post='771553' date='21-Apr-2009 16:10']Is there a way for the batch file code to wait until a call to SHELL has been completed?
    Example Code:
    Run 1st line of code
    Call Shell("D:\BatchFiles\MyBatchFile.Bat", vbNormalFocus)
    ' want to wait here until the MyBatchFile.Bat has been fully executed
    Run 3rd line of code[/quote]
    That doesn't seem to be the correct question!
    Do you mean "Can VBscript wait until a BATch file has completed?"
    If so, you want a VBScript person to answer, rather than a BATch file person!
    (If I run CALL SHELL in a BATch file, it responds:
    'shell' is not recognized as an internal or external command,
    operable program or batch file.
    )
    BATcher

    Time prevents everything happening all at once...

  3. #3
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts
    If that badger character is correct and you're working with VBScript, the 2nd parameter of the Run method of the Shell object is WaitOnReturn. If you set it to True, the script waits until the shelled program has finished before the script continues.

    More here: Scripting Guide for Windows.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •