locked
Script help to launch 2 programs at a same time RRS feed

  • Question

  • I have 2 applications where they need to launch one by one due to some memory API requirement. So installed the both applications on Server and wrote a cmd file as below 

    c:\scripts\app1tray.exe.lnk
    c:\scripts\app1.exe.lnk
    "c:\scripts\app2.lnk"
    exit

    App 2 is in quotes as the shortcut have spaces. 

    When the cmd script is launched I see cmd prompt starting and launching the  app1 and then hangs there until i close the program 1 , then program 2 launches . Same Script on old Server farm


    I have also tired using VB script as follow 

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "c:\scripts\app1tray.exe.lnk", 0, false
    WshShell.Run "c:\scripts\app1.exe.lnk", 0, false
    WshShell.Run "c:\scripts\app2.lnk", 0, False

    When I use the VBS script , it launches the app2 first and when i close the app2 then it launches app1 . 

    I am not fussed in using vb script or bat file. 

    Legacy farm is on Server 2003 (bat file is used)
    and new farm is on Server 2008 (not R2 due to application compatibility)


    Pointers i am looking is for 
    1.How to make this script working for 2 applications launch with out seeing the cmd prompt?

    Please help me to solve the issue. Thanks in Advance.
    Sunday, November 18, 2018 1:30 PM

Answers

  • use Start, this way you get back control immediately and run the next command.

    i.e.

    *********---*****

    Start  c:\scripts\app1tray.exe.lnk
    start c:\scripts\app1.exe.lnk
    start "c:\scripts\app2.lnk"
    exit

    **********____*******

    Start command has some options to run minimized, maximized and much more.

    Start /? ; will get you more info.

    • Marked as answer by AdminMaster Monday, November 19, 2018 11:04 AM
    Sunday, November 18, 2018 6:52 PM

All replies

  • Use True instead of false to have shell wait.


    \_(ツ)_/

    Sunday, November 18, 2018 3:13 PM
  • Thanks for the suggestion , "true" has worked however till I close the first app , 2nd app is not launching. I need apps to be launched automatically. 
    Sunday, November 18, 2018 4:50 PM
  • If you launch them asynchronously then you will have no control over the order of execution or completion.

    If you use PowerShell you will gain a bit more control.


    \_(ツ)_/

    Sunday, November 18, 2018 5:15 PM
  • use Start, this way you get back control immediately and run the next command.

    i.e.

    *********---*****

    Start  c:\scripts\app1tray.exe.lnk
    start c:\scripts\app1.exe.lnk
    start "c:\scripts\app2.lnk"
    exit

    **********____*******

    Start command has some options to run minimized, maximized and much more.

    Start /? ; will get you more info.

    • Marked as answer by AdminMaster Monday, November 19, 2018 11:04 AM
    Sunday, November 18, 2018 6:52 PM
  • "start" is the same as the VBScript "Run" with a "false" parameter.  It doesn't work as expected.  "start" is only useful in batch files.


    \_(ツ)_/


    • Edited by jrv Sunday, November 18, 2018 8:53 PM
    Sunday, November 18, 2018 8:52 PM
  • Thank you very much for the replies , 

    I have amended the cmd file to following and everything is working as expected. 

    Start c:\scripts\app1tray.exe.lnk
    Start c:\scripts\app1.exe.lnk
    Start c:\app2.exe
    exit

    Monday, November 19, 2018 11:04 AM