title: How to make a batch file that detects when a program closes and then restarts the application?
body: <p>Is there a way that I can make a program re-open itself when it closes?</p>
  
  <p>I have this program that runs; and it gets a pop up; when you press okay it closes the program. I know I can start any executable with a batch, but how would I make it run all on it's own when it detects the program has closed?</p>
  
  <p>I am able to start the program with this code:</p>
  
  <pre><code>@echo off
  start "" "C:\Program Files (x86)\Winstep\WinstepXtreme.exe"
  </code></pre>
  
  <p>But I want this batch file to launch when <code>WinstepXtreme.exe</code> terminates.</p>
  
  <p>UPDATE: okay so the suggested code works but its activating non stop making the PC unable to do certain thing's, also the cmd window stay opne but i fixed that. in my process list there are two files: Nextstart.exe and Workshelf.exe, not sure if there is a code command where you can type, if "workshelf.exe" doe sent exist then start workshelf.exe? If Not Exist "%ProgramFiles(x86)%" Goto???</p>
  
  <p>---------->[SOLUTION]&lt;----------</p>
  
  <p>@echo off</p>
  
  <p>:Restart
  start "Edit Text" /wait "C:\Program Files (x86)\Winstep\WorkShelf.exe"</p>
  
  <p>goto restart</p>
  
  <p>adding workshelf.exe instead of winstep made it stable, winstep exe launches a) next start and b) workshelf, only needed workshelf to restart but i can add multiple directory's of thing's to restart if closed.</p>