Command Window Interface

Customization

Changing the background color

The background color is controlled by the PROMPT variable. This variable can be fixed in the CONFIG.SYS file, in which case it applies to all command windows. It can be also changed locally, for a given command window object, by entering the appropriate instructions in the Parameters section of the Program page of the settings notebook. The command PROMPT locally changes the value of the PROMPT variable.

The following is the list of display attributes that figure in the PROMPT variable.

ColoRBF
Black4030
Red4131
Green4232
Yellow4333
Blue4434
Magenta4535
Cyan4636
White4737

In addition to this: 0=Attributes off (black on white display), 1=Bold, 2=Normal, 5=Blinking, 7=Reverse Colors and 8=Invisible.

These attributes are used within a prompt escape sequence:

SET PROMPT=$e[x1  ;x2  ;...;xn  m [+Residual Terms]
where xj are some of the above listed parameters.

Changing the size of the Command Window

The size of the command window is controlled by using the MODE command, as follows
MODE COx,y
where x is the number of characters per line, and y is the desired number of rows.

To create a command window object that always opens with given dimensions (x,y) it is sufficient to put

/k MODE COx,y
in the Parameters section of the Program page of the Settings notebook. After opening such a command window object, this will first execute MODE, change the size of the window and then give the control back to the command processor (ensured by the /k parameter--otherwise the command window would close after executing MODE!).

Another way to permanently change the size of a command window object is to to hold the Left-Shift key while resizing the window.

Command Manipulations

Long commands

If a command string is too long to fit into a single line--pressing
^-Enter switches to a new line. It is not allowed to break a command string in the middle of a word.

Multiple Commands and Special Symbols

To execute multiple commands within one command string, it is necessary to separate the commands by the ampersand symbol &.

The two ampersand symbols A&&B is the conditional execution--the command B will run only if A succeeds. Similarly A||B executes B only if A fails. The standard brackets ( ) can be used as grouping symbols within a command string. The symbol | pipes the output of the preceding command.

The symbols < and > are used to redirect the inputs and outputs respectively. Redirected output replaces any existing data. In order to append the redirected output, use >>.

Starting Sessions

The START command is used to launch an arbitrary OS/2 program, and to return the control to the command window (so that other commands can be executed from the same window).

The syntax is:

START "OptionalName" </k /c /n> </fs /win> </f /b> </pm /dos>
</max /min> </i> </pgn> Program_Name Program_Opts

Here the OptionalName will be displayed on the program window titlebar, and it will identify the program in the Window List.
/k
Use a command processor to start the program and keep the session open after completing the program.
/c
Use a command processor, but close the session after the program is completed.
/n
Starts the program directly (without an auxiliary command processor).
/fs /win
Full-screen/windowed session.
/f
Brings the session to the foreground
/b
Runs the session in the backround, without changing the focus.
/pm
Informs the shell the program is a Presentation Manager application.
/dos
Starts a DOS session.
/max /min
Starts a (maximized window/minimized arbitrary) session.
/i
Induce the environment variables from the command window session.
/pgn
Informs the shell that the program name contains spaces, so that Program_Name must be a quoted string. Such a situation is possible on HPFS partitions only.

Moving left/right within a command line

To jump from one word to the beginning of a neighbouring one use Ctrl-Left and Ctrl-Right keys. Use Home/End to move to the beginning/end of the command line. Requires keys=ON.

Re-calling Commands

By default, OS/2 keeps a short command-line history in a special buffer. It is possible to scroll through this list by using Up and Down arrow keys. It is possible to scroll through the restricted list of all executed commands that begin with a fixed character combination--by typing this combination and then consecutively pressing the F1 key. Requires keys=ON.

Shutting Down from a Command Window

To initiate the WPS shutdown use the SHUTDOWN command. The executable SHUTDOWN.EXE is located in X:\OS2\INSTALL directory.