Running an .exe file in sychronous mode RRS feed

  • Question

  • I need to create a script (PowerShell script, .cmd, .bat, .vbs or any other type) to launch an .exe file and wait for the execution to complete in an unattended ans synchronous way.
    In PowerShell the script should look like:

    write-host "Before starting"
    c:\myfolder\myprogram.exe /arg1 /arg2
    write-host "Terminated"

    The message "Terminated" must appear only after myprogram.exe completed.
    What is the right syntax to create a PowerShell script?
    Is there a better solution based on any other scripting technology?
    Thursday, June 8, 2017 4:33 PM

All replies

  • I'm not 100% sure, but you may need to utilize a job in order to accomplish what you are looking for.


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    • Proposed as answer by Hello_2018 Friday, June 9, 2017 9:13 AM
    Thursday, June 8, 2017 4:37 PM
  • By default a program will wait until it completes.  The code posted would works as requested.  Have you even tried it?


    • Proposed as answer by Hello_2018 Tuesday, June 13, 2017 3:11 AM
    Thursday, June 8, 2017 5:50 PM