Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file stops running if it launches an exe file  (Read 12019 times)

0 Members and 1 Guest are viewing this topic.

makifej

    Topic Starter


    Newbie

    Batch file stops running if it launches an exe file
    « on: May 12, 2009, 06:52:21 AM »
    Hello!

    I've made a batch file to repair and re-register the WMI. The batch file is the following:

    rundll32 wbemupgd, UpgradeRepository
    cd /d %windir%\system32\wbem
    for %%i in (*.dll) do RegSvr32 -s %%i
    for %%i in (*.exe) do %%i /RegServer

    In the fourth line, it launches the wbemtest.exe that has a GUI, and the batch file does not go on running until I close the wbemtest.exe GUI. It is quite annoying because I want the batch file to run as a scheduled task and I do not want to press buttons.
    Plus, I've before made batch files that launches other exe files without GUI and these bactch files also suspend running till the exe files are closed, and I sometimes need to run several exe files at the same time without closing any of them. So:

    Is there any way to make a batch file continue running when it launches an exe file?

    Thanks for help in advance.

    moulding

    • Guest
    Re: Batch file stops running if it launches an exe file
    « Reply #1 on: May 12, 2009, 08:16:28 AM »
    I'm not the foremost expert, but I believe the problem is that, by default, scripts are run synchronously.  That means, each step in the script must finish before the next step starts.

    The "start" command was created to run steps asynchronously:

      start <command> <command-args>

    For example, to run notepad (on a file called mytest.txt) asynchronously, you would type:

      start notepad.exe mytest.txt

    Running things asynchronously, particularly things with GUIs, can be very ... tricky.  If you have a large number of things, it could really bog down your computer.  If they have GUIs, all of the GUIs will open at the same time.  Either way, your computer could become very difficult to use.

    good luck

    makifej

      Topic Starter


      Newbie

      Re: Batch file stops running if it launches an exe file
      « Reply #2 on: May 12, 2009, 09:00:58 AM »
      Thanks for this useful info.

      Do you know a way to run the batch file mentioned above completely without having closed the wbemtest.exe GUI?