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. Is there any way to tell it to wait until the process it started completes and then shutdown? Improve this question. JeffG 1, 6 6 silver badges 18 18 bronze badges. Kravlin Kravlin 1 1 gold badge 6 6 silver badges 9 9 bronze badges.
Add a comment. Active Oldest Votes. Improve this answer. Can you chain? However BAT appears to make a distinction between console apps and windows apps, and it executes them a little differently. But for console apps, that are invoked synchronously, inside the same command window as the BAT itself is running in. The original solution works great. However, on some machines, it is wise to put a delay immediately after starting the executable. Otherwise, the task name may not appear in the task list yet, and the loop will not work as expected someone pointed that out.
The 2 delays can be combined and put at the top of the loop. Can also get rid of the 'else' just to shorten. Example of 2 programs running sequentially:.
This is my adaptation johnrefling's. This work also in WindowsXP; in my case i start the same application at the end, because i want reopen it with different parametrs. My application is a WindowForm. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to wait for a process to terminate to execute another process in batch file Ask Question.
Asked 10 years, 1 month ago. Active 2 years, 3 months ago. Viewed k times. Improve this question. DogDog DogDog 4, 12 12 gold badges 42 42 silver badges 62 62 bronze badges. Some programs like write will detach from the parent process, while other programs like notepad do not. Oh wow. That's horrible. Note that the node number can be changed to any valid node number for that computer without having to change the affinity mask. When a file that contains a. The filename extension does not have to be.
Non-executable files can be invoked through their file association just by typing the name of the file as a command. DOC would launch the application associated with the. DOC file extension.
This prevents picking up CMD. EXE from the current directory. When searching for an executable, if there is no match on any extension, then looks to see if the name matches a directory name.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog.
Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
Linked Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings.
0コメント