And this is the reason it works - the piped command waits for input until the. If the exe you call then creates other process, such as calling another exe, and then exits the batch file will continue processing after the called exe has terminated, as it has no knowledge of other processes started by it. In your case this is a real problem because installers normally extract files from some form of compressed container, which may be embedded in the exe itself, then fire off one of the extracted files and exit.
Some installers provide command line parameters which tell the original exe not to exit until the entire installation is complete, so that's something you may want to investigate. Other than that, there's no real way around this with batch files alone and would take a programmatic solution to solve. I created a "while loop" to check if its running and then move on once its done. The times can be tweaked to suit your needs. Similar to FreeSoftwareServers file, I needed to wait for a program to start that wasn't started by the batch file.
Then wait several seconds to start a program that hooks onto the program I'm checking for. If you want the file to timeout after checking a certain amount of times, you could use a counter within the loop to limit the amount of times it loops. This can be modified to fit your needs. Or if you know how long it takes to execute, you can take a look at the sleep command, provided by the Windows Server Resource Kit Tools.
Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. How do you wait for an exe to complete in batch file? Ask Question. Asked 10 years, 10 months ago. Active 1 year, 4 months ago. Viewed k times. Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services.
Privacy policy. Calls one batch program from another without stopping the parent batch program. The call command accepts labels as the target of the call. The following table shows how you can combine modifiers with the batch parameters for compound results:. The first time the end of the batch file is encountered that is, after jumping to the label , control returns to the statement after the call statement.
The second time the end of the batch file is encountered, the batch script is exited. You can create a batch program that calls itself. Enclosing the folder name in double quotes tells Windows the spaces are part of the folder name.
A batch file can only execute or start another program. Once it is started, it cannot perform additional functions within that program. In some situations, some programs may support additional syntax or options that allow you to perform additional functions. If you are looking for a language or tool to help perform more automation, we suggest AutoHotkey.
0コメント