Sean's Personal Code Samples And References

Start a program, command or batch script (opens in a new window.)

      START "title" [/Dpath] [options] "command" [parameters]

   title      : Text for the CMD window title bar (required)
   path       : Starting directory
   command    : The command, batch file or executable program to run
   parameters : The parameters passed to the command

   /MIN       : Minimized
   /MAX       : Maximized
   /WAIT      : Start application and wait for it to terminate
   /LOW       : Use IDLE priority class
   /NORMAL    : Use NORMAL priority class
   /HIGH      : Use HIGH priority class
   /REALTIME  : Use REALTIME priority class

   /B         : Start application without creating a new window. In this case
                ^C will be ignored - leaving ^Break as the only way to 
                interrupt the application
   /I         : Ignore any changes to the current environment.

   Options for 16-bit WINDOWS programs only

   /SEPARATE   Start in separate memory space (more robust)
   /SHARED     Start in shared memory space (default)
Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes ""
According to the Microsoft documentation, the title is optional, but you may will have problems if it is omitted.

e.g. START "" MarchReport.DOC will launch the application associated with the .DOC file extension and load the document.


Run a minimised Login script:
START "My Login Script" /Min Login.cmd

Start a program and wait for it to complete before continuing:
START "" /wait autocad.exe

Open a file with a particular program:
START "" "C:\Program Files\Microsoft Office\Winword.exe" "D:\Docs\demo.txt"

Open Windows Explorer and list the files in the current folder (.) :
C:\any\old\directory> START .

Connect to a new printer: (this will setup the print connection/driver )
START \\print_server\printer_name

Start an application and specify where files will be saved (Working Directory):
START /Dc:\Documents\ /MAX "Maximised Notes" notepad.exe

Run several Programs in Sequence
To run a sequence of 32 bit GUI programs to complete a task, create a batch file that uses start /wait:
@echo off
start /wait /b First.exe
start /wait /b Second.exe
start /wait /b Third.exe
This is similar to the way batch files would run under MSDOS (16 bit)

It is best to specify the full path to the application including file extension. If you START an application without a file extension (for example WinWord instead of WinWord.exe)then the PATHEXT environment variable will be read to determine which file extensions to search for and in what order. The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD
The syntax for PATHEXT is the same as %PATH%, with semicolons separating each item.
If there is no match on any extension, then START will look to see if the name, matches a directory name and if so will launch Explorer on that path.

If Command Extensions are disabled, the START command will no longer recognise file Associations, and will not automatically evaluate the COMSPEC variable when starting a second CMD session.

Sean Marcellus