title: How to close a console window that has been created by "START"?
body: <p>I use Windows XP and have the following two batch files:</p>
  
  <p><strong>start_up.bat:</strong></p>
  
  <pre><code>C:
  cd "C:\programs\hsqldb\hsqldb-2.1.0\hsqldb\bin\"
  start C:\programs\hsqldb\hsqldb-2.1.0\hsqldb\bin\runServer.bat
  C:\programs\tomcat\apache-tomcat-6.0.26\bin\startup.bat
  </code></pre>
  
  <p><strong>shut_down.bat:</strong></p>
  
  <pre><code>cmd /c "C:\programs\tomcat\apache-tomcat-6.0.26\bin\shutdown.bat | ant -verbose -buildfile shutdown.xml hsqldb-stop" 
  </code></pre>
  
  <p>The directory from which I invoke these two files contains:</p>
  
  <pre><code>start_up.bat
  shut_down.bat
  shutdown.xml
  </code></pre>
  
  <p>As you can see, I am trying to start up HSQLDB + TOMCAT and then shut them down.</p>
  
  <p>The problem is, the window where HSQLDB runs will not close automatically after HSQLDB shuts down (the ant command shuts down HSQLDB). I think it is because I created this window by "START", but I do not know how close that window.</p>
  
  <p>If I try to create that window and give it a name, e.g. the name "db", by:</p>
  
  <p><code>start "db" C:\programs\hsqldb\hsqldb-2.1.0\hsqldb\bin\runServer.bat</code></p>
  
  <p>then I still don't know how to close a window according to its name.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I've found a way to "close" a window by its title:</p>
  
  <p><code>taskkill /f /fi "WINDOWTITLE eq mytitle"</code></p>
  
  <p>So I have changed my batch files to be:</p>
  
  <p><strong>start_up.bat:</strong></p>
  
  <pre><code>C:
  cd "C:\programs\hsqldb\hsqldb-2.1.0\hsqldb\bin\"
  start "hsqldb" C:\programs\hsqldb\hsqldb-2.1.0\hsqldb\bin\runServer.bat
  C:\programs\tomcat\apache-tomcat-6.0.26\bin\startup.bat
  </code></pre>
  
  <p><strong>shut_down.bat:</strong></p>
  
  <pre><code>cmd /c "C:\programs\tomcat\apache-tomcat-6.0.26\bin\shutdown.bat | ant -verbose -buildfile shutdown.xml hsqldb-stop"
  taskkill /f /fi "WINDOWTITLE eq hsqldb"
  </code></pre>
  
  <p>And now the "hsqldb" window closes after HSQLDB is shut down.</p>
  
  <p>If you find a more direct solution feel free to let me know.</p>