<http://www.netikka.net/tsneti/info/tscmd036.htm>
Copyright © 2003-2010 by Prof. Timo Salmi  
Last modified Mon 24-May-2010 19:50:01

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



36} I start a program from my script and it hogs my command window.

A question frequently presented also in a format like "How to start windows program from batch file without the command prompt window".

Occasionally one may want to call a program from the command line window. Furthermore, it sometimes is useful to build calling that program into a script e.g. for customization. However, when one does, the command window will "freeze" to wait for the completion of the task. How can one avoid that and free the command window for other parallel usages? The trick is to start the program using the START internal command.

The basic format of the start command is
   START "title" command/program
Including the "title" is essential. Most questions and confusion arise from failing to include it, even if commonly it is left empty:
   START "" whatever

For example, my favorite text editor is the SemWare Editor Professional. Below is one of the options of how I may call it. It is a batch/script that is meant to work on both a 95 and on a XP PC. This means that in Windows95 it must not have to encounter unknown (CMD.EXE) lines of the batch/script. Furhermore, note the difference in the format of calling the program with the START.
  @echo off
  :: E.BAT by Prof. Timo Salmi
  :: One option for calling the SemWare Editor Professional
  ::

  if [%OS%]==[Windows_NT] goto _nt
  if [%1]==[] L:\TSEPro\e32 *.*
  if not [%1]==[] L:\TSEPro\e32 %1 %2 %3 %4 %5 %6 %7
  goto _out
  ::
  :_nt
  if "%~1"=="" (
    start "" "C:\Program Files\TSEPro\e32" *.*
      ) else (
    start "" "C:\Program Files\TSEPro\e32" %*)
  ::
  :_out

In the above "the %* batch parameter is a wildcard reference to all the arguments, not including %0, that are passed to the batch file."

References/Comments: (If a Google message link fails try the links within the brackets.)
  Google Groups Oct 24 2003, 1:21 pm [M] [T]
  Google Groups Dec 21 2003, 7:49 am [M] [T]
  Google Groups Sep 30 2004, 8:00 am [M] [T]
  Google Groups 21 Jun 2009 00:52:53 [M] [T]
  Google Groups 6 Mar 2010 5:30 am [M]