[Toc][Index]

Starting CMD.EXE


Each CMD.EXE object on your OS/2 desktop represents a different CMD.EXE 
session.  You can configure any of these sessions to run in windowed or 
full-screen mode, and you can set any necessary command line parameters 
for CMD.EXE, by adjusting the properties of the desktop objects. 
To adjust the properties of an object you need to be familiar with how 
object properties are set in your version of OS/2.  For details see your 
OS/2 documentation, or the CMD.EXE Introduction and Installation Guide. 
When you configure a CMD.EXE object, place an asterisk [*] in the Program 
Name field, and put any startup options that you want passed to CMD.EXE 
(e.g., @inifile) in the Parameters field.  For example: 


     Path and file name:  *
     Parameters:          @D:\START\CMD.INI
     Working directory:   C:\

(If CMD.EXE is not set up as your default OS/2 shell in CONFIG.SYS, use 
the full path and name for CMD.EXE.EXE as the program name, rather than 
the asterisk.) 
To run a startup batch file for a particular CMD.EXE session, include its 
name (with a path, if the batch file is not in the session's startup 
directory) as the last item in the Parameters field when you configure the 
desktop object.  That batch file will be executed after any 4START file, 
but before the first prompt is displayed.  You can use the batch file to 
set environment variables and execute any other CMD.EXE commands. 
You can also execute any internal CMD.EXE command, external command, or 
alias by placing its name in the Parameters field.  For example: 


     Path and file name:  *
     Parameters:          D:\STARTOS2.CMD
     Working directory:   C:\

To execute an internal or external command, an alias, or a batch file and 
then exit (return to the desktop) when it is done, place /C command 
(rather than just command) as the last item in the Parameters field.  For 
example: 


     Path and file name:  *
     Parameters:          /C COMFILES.BTM
     Working directory:   C:\

The CMD.EXE command line does not need to contain any information.  When 
invoked with an empty command line, CMD.EXE will configure itself from the 
CMD.INI file, run 4START, and then display a prompt and wait for you to 
type a command.  However, you may add options on the CMD.EXE command line 
to change the way CMD.EXE operates. 
CMD.EXE recognizes several optional fields on the command line. All of the 
options go on one line.  If you use more than one of these fields, their 
order is important.  The syntax for the command line is: 
        [d:\path] [@d:\path\inifile] [//iniline]... [/L] [/LA] [/LD] [/LH] 
        [/S] [/C | /K] [command] 
 The options are: 
        d:\path:  CMD.EXE will use this directory and path to set the 
        COMSPEC environment variable for this session.  If this option is 
        not used, COMSPEC is set from the location of CMD.EXE.EXE. 
         CMD.EXE always knows what drive and directory it was started from 
        and can set COMSPEC accordingly.  It is included only for 
        compatibility with CMD.EXE.  This option cannot be used for 
        secondary shells. 
        @d:\path\inifile:  This option sets the path and name of the 
        CMD.INI file.  You do not need this option if you aren't using a 
        CMD.INI file, or if the file is named CMD.INI and is stored in the 
        same subdirectory as CMD.EXE.EXE or in the root directory of the 
        boot drive.  This option is most useful if you want to start a 
        CMD.EXE session with a specific and unique .INI file. 
        //iniline:  This option tells CMD.EXE to treat the text appearing 
        between the // and the next space or tab as a CMD.INI directive. 
         The directive should be in the same format as a line in CMD.INI, 
        but it may not contain spaces, tabs, or comments.  This option 
        overrides any corresponding directive in your CMD.INI file.  It is 
        a convenient way to send CMD.EXE one or two simple directives 
        without modifying or creating a new CMD.INI file. 
        /L, /LA, /LD, and /LH:  These options force CMD.EXE to to use a 
        local alias, directory history, and / or command history list. 
         They can be used to override any LocalAliases=No, 
        LocalDirHistory=No, or LocalHistory=No settings in CMD.INI.  This 
        allows you to use global lists as the default, but start a 
        specific CMD.EXE session with local lists.  /LA forces local 
        aliases, /LD forces local directory history, /LH forces local 
        history, and /L forces all three. 
        See Command History for details on local and global history, 
        Directory History Window for details on local and global directory 
        history, and ALIAS for details on local and global aliases. 
        /S:  This option tells CMD.EXE that you do not want it to set up a 
        Ctrl-C / Ctrl-Break handler.  It is included for compatibility 
        with CMD.EXE, but it may cause the system to operate incorrectly 
        if you use this option without other software to handle Ctrl-C and 
        Ctrl-Break. 
        [/C | /K] command:  This option tells CMD.EXE to run a command 
        when it starts.  The command will be run after 4START has been 
        executed and before any command prompt is displayed.  It can be 
        any valid internal or external command, batch file, or alias; you 
        may include multiple commands by using the command separator.  All 
        other startup options must be placed before the command, because 
        CMD.EXE will treat characters after the command as part of the 
        command and not as additional startup options. 
        When the command is preceded by a /C, CMD.EXE will execute the 
        command and then exit and return to the parent program or the OS/2 
        desktop without displaying a prompt. 
        The /K switch has no effect; using it is the same as placing the 
        command (without a /C or /K) at the end of the startup command 
        line.  It is included only for compatibility with CMD.EXE. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs