Copyright: Copyright 1993 - 1995, JP Software Inc.


Table of Contents

Commands

By Name

By Category

Take Command Help

About Take Command Help

Using Take Command Help

Using Take Command

Conventions

The Command Line

Redirection and Piping

File Selection

Batch Files

Using a Windows Command Line

Starting Windows Applications

Take Command and DOS Applications

Take Command for 4DOS Users

The Take Command Screen

Menus

Tool Bar

Status Bar

Scrollback Buffer

Highlighting and Copying Text

Cursor Display on LCD Screens

The Environment

Using The Environment

Internal Variables

Variable Functions

Configuring Take Command

Startup

Configuration Dialogs

TCMD.INI

Take Command and Windows

Windows File Associations

Take Command and Windows Shells

Using "Drag and Drop"

Using Dynamic Data Exchange (DDE)

Miscellaneous

Error Messages

Key Code Tables

Support


About Take Command Help

Take Command for Microsoft Windows

Version 1.01 Help System

Text by Hardin Brothers, Tom Rawson, and Rex Conn

Copyright © 1994 - 1995, JP Software Inc., All Rights Reserved.

Take Command, JP Software, 4OS2, and all JP Software designs and logos are trademarks, and 4DOS® is a registered trademark, of JP Software Inc.  Windows and Windows NT are registered trademarks of Microsoft Corporation.  Other product and company names are trademarks of their respective owners.

[1.00.043 - 8/95]


Using the Take Command Help System

This online help system for Take Command covers all Take Command features and internal commands.  It includes reference information to assist you in using Take Command and developing batch files, and it includes most -- but not all -- of the details which are included in the printed Take Command manuals.

If you type part or all of a command on the line and then press F1, the help system will provide "context-sensitive" help by using the first word on the line as a help topic.  If it's a valid topic, you will see help for that topic automatically; if not, you will see the Table of Contents for this help file, and you can pick the topic you want.

You can use this feature to obtain help on any topic -- not just on commands.  For example, if you enter the command HELP _DISK you will see help for the _DISK internal variable.

If you type the name of any internal command at the prompt, followed by a slash and a question mark [/?] like this:

copy /?

then you will also see help for the command.

The /? option may not work correctly if you have used an alias to redefine how an internal command operates.  To view the /? help for such a command you must add an asterisk to the beginning of the command to disable alias processing.  For example, if you have defined this alias:

alias copy *copy /r

then the command COPY /? will be translated to COPY /R /?, which will not work properly.  However, if you use *COPY /?, the alias will be ignored and the /? will work as you intended.

Take Command uses the Windows help system to display help text. Once you've started the help system with HELP or F1, you can use standard Windows keystrokes to navigate.  For more information, click on the Help menu at the top of this window.

Finally, if you use a command incorrectly, omit a required parameter, or use an unrecognized option, Take Command will display a syntax summary of the command.


Run Dialog
Run Program Dialog

Enter the name of the program you wish to run, along with any command-line parameters, in the Command Line field.

When the focus is on the Command Line field, the up and down arrow keys will display previous command lines, one at a time.

If you click on the arrow to the right of the Command Line field, you will see a list of previous commands you have issued from this dialog.  You can select any item from the list to re-execute or to modify.

You can enter the name of a data file on the Command Line if an Executable Extension has been defined for the file.


Configuration Dialogs

These dialogs control the configuration of Take Command.  Each option in one of the configuration dialogs sets a corresponding directive in TCMD.INI.  You can start the configuration dialogs with the Configure Take Command selection on the Options menu.

While you are using the dialogs, you can move between sets of configuration options with the list box in the left-hand pane.  The sets of options available in this dialog are:

Startup Options

Display Options

Command Line Options

General Options 1

General Options 2

Command Options

If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.


Startup Options Dialog

You can use this dialog to set some of the configuration directives in TCMD.INI.  If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.

While you are using the dialog, you can move between sets of configuration options with the list box in the left-hand pane.

You can set the path to your TCSTART and TCEXIT files if they aren't in the same directory as Take Command.  This field sets the TCStartPath directive.

In the TCMD.INI section, you can set the value of the INIQuery directive.

In the Buffer Sizes section,

*	Command History sets the size of the command history list, and the value of the History directive.

*	Directory History sets the size of the directory history list, and the value of the DirHistory directive.

The Display section sets the size and location of Take Command's window when it starts up.

*	Standard, Max, Min, and Custom set the WindowState directive.

*	The window position and size fields set the WindowX, WindowY, WindowHeight, and WindowWidth directives.  Use these if you want Take Command to start up at a specific location on your desktop.  These fields are ignored unless the item above is set to Custom.

The Cursor section sets the shape of the cursor and the IBeamCursor directive.  Use the I-Beam shape for normal systems, and the Arrow shape for laptop or other systems where the I-Beam cursor is hard to see.


Display Options Dialog

You can use this dialog to set some of the configuration directives in TCMD.INI.  If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.

While you are using the dialog, you can move between sets of configuration options with the list box in the left-hand pane.

The Text Dimensions section configures the way that text appears in Take Command's main window.

*	Width sets the number of columns that Take Command uses for its displays and sets the ScreenColumns directive.

*	Tabs selects the location of tab stops and sets the TabStops directive.

The Window Configuration section controls the appearance of the Tool Bar and Status Bar.  For each bar,

*	If you check Enable, the bar will be visible (the Tool Bar will only be visible if you have defined at least one button for it).  Enable sets the StatusBarOn or ToolBarOn directive.  These settings are also modified when you enable and disable the toolbar from the Options menu.

*	The Font Height sets the size of text on the Tool Bar and Status Bar, and the StatBarText or ToolBarText directive.

The Scrolling section controls Take Command's screen scrollback buffer.

*	Buffer Size sets the size of the screen buffer, and the value of the ScreenBufSize directive.  Valid sizes are from 16000 to 64000 bytes.

*	Scroll Lines controls how much the screen scrolls when Take Command's text has reached the bottom of the window, and sets the ScrollLines directive.  Lower values produce slower but smoother scrolling.

The Colors section sets default screen colors.

*	Output establishes the default colors Take Command uses for the text it displays, and sets the StdColors directive.

*	Input establishes the colors for echoing the commands you type, and sets the InputColors directive.


Command Line Options Dialog

You can use this dialog to set some of the configuration directives in TCMD.INI.  If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.

While you are using the dialog, you can move between sets of configuration options with the list box in the left-hand pane.

The Editing section controls command-line editing.

*	Default Mode selects whether you begin editing in Overstrike or Insert mode, and sets the EditMode directive.

*	Cursor sets the width of the cursor for both Overstrike and Insert modes, and sets the CursorIns and CursorOver directives.  The width is expressed as a percentage of the width of a character cell.

In the Command History section

*	The Scroll / History keys setting controls whether Take Command or 4DOS defaults are used for scrolling through the scrollback buffer and the command history.  The Normal setting uses the arrow and PgUp / PgDn keys for the scrollback buffer, and the corresponding control keys (Ctrl-Up, Ctrl-Down, etc.) for the command history.  The Swapped setting reverses these assignments.  For more details see Scrolling and History Keystrokes.  This option sets the value of the SwapScrollKeys directive.

*	Minimum saved characters sets the size of the shortest line that will be saved in the command history, and sets the value of the HistMin directive.

*	Copy to end, if checked, copies a recalled command to the end of the history list each time it is executed, and sets the HistCopy directive.

The History Windows section sets the position and size of the popup history window and sets the HistWinLeft, HistWinTop, HistWinWidth, and HistWinHeight directives.


Options 1 Dialog

You can use this dialog to set some of the configuration directives in TCMD.INI.  If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.

While you are using the dialog, you can move between sets of configuration options with the list box in the left-hand pane.

The Descriptions section sets the way that Take Command handles file descriptions entered with the DESCRIBE command.

*	The Enable checkbox enables or disables the display and processing of descriptions, and sets the Descriptions directive.

*	The Maximum Length field determines the maximum size of file descriptions and sets the DescriptionMax directive.

The Special Characters section sets the characters that have special meaning for Take Command.  See 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for information on how to change these to make Take Command more compatible with 4DOS, 4OS2, and 4DOS for Windows NT.

*	Separator is the character that separates multiple commands.  It can also be set with the CommandSep directive or SETDOS /C.

*	Escape is the escape character which suppress the normal meaning of the following character.  It can also be set with the EscapeChar directive or SETDOS /E.

*	Parameter sets the character used after a percent sign to specify all or all remaining command-line arguments in a batch file or alias.  It can also be set with the ParameterChar directive or with SETDOS /P.

Default Beep sets defaults for the BEEP command and for "error" beeps.  To disable error beeps, set the beep length to 0, and be sure to specify an explicit length each time you use the BEEP command.

*	Length sets the length of the beep in timer ticks that are approximately 1/18 of a second each.  It also sets the BeepLength directive.

*	Frequency sets the frequency of the beep in Hz.  It also sets the BeepFreq directive.

The Options section sets miscellaneous options.

*	Force upper case, when selected, forces Take Command to display file names in upper case in internal commands like DIR and COPY.  You can use the UpperCase directive or the SETDOS /U command achieve the same result.

*	Default batch echo, if selected, turns on echoing in batch files by default.  You can use the BatchEcho directive or the SETDOS /V command to achieve the same result.

*	Protect redirected output files, if selected, keeps Take Command from overwiritng an existing file with redirected (>) output or from creating a new file with output redirected in append (>>) mode.  You can achieve the same result with the NoClobber directive or the SETDOS /N command.

*	The Time options determine how Take Command displays times.  If you select Country, the time display is based on your country settings in Windows.  The am/pm setting forces a 12-hour display with a trailing "a" or "p."  The 24-hour setting forces a standard 24-hour display.  You can also set the time display with the AmPm directive.


Options 2 Dialog

You can use this dialog to set some of the configuration directives in TCMD.INI.  If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.

While you are using the dialog, you can move between sets of configuration options with the list box in the left-hand pane.

The Logging section enables or disables Command and History logging (see the LOG command) and sets the file name to use for each.  It also sets the LogName and HistLogName directives.

The Windows Interface section sets the method that Take Command uses to communicate with Program Manager or a replacement Windows shell.  See the ProgmanDDE directive and the Take Command and Windows Shells topic for more details.  This section also controls whether Take Command prompts before exiting when it is the Windows shell (see PromptShellExit).

The Eval Precision sets the minimum and maximum number of digits after the decimal point that @EVAL will display.  You can achieve the same results with the EvalMin and EvalMax directives or with the SETDOS /F command.

The External Programs setting controls whether Take Command waits for applications to complete before displaying the prompt.  This setting applies only to applications started from the Take Command prompt, including DOS applications which are not run under Caveman.  Take Command will always wait for applications run from batch files, and for DOS applications started under Caveman.  It also has no effect on applications started with the START command, which has its own separate /WAIT switch.  This option sets the ExecWait directive.


Command Options Dialog

You can use this dialog to set some of the configuration directives in TCMD.INI.  If you exit from the dialog with the Save button, your changes will be written to your TCMD.INI file and will be in effect for the both the current and future sessions.  If you exit with the OK button, the changes you have made will be in effect for the current session of Take Command but not for future sessions.

While you are using the dialog, you can move between sets of configuration options with the list box in the left-hand pane.

The DIR Colors field sets the colors used by DIR and SELECT.  You can achieve the same effect with the ColorDir directive or by setting the COLORDIR environment variable.  See Color Coded Directories for details.

The LIST section sets the foreground and background colors for the LIST command.  It also sets the ListColors directive.

The SELECT section sets the foreground and background colors for the SELECT command.  It also sets the SelectColors directive.

The Editor Filename sets the path and name of the program you want to use when you use when you select Editor from the Utilities menu.  It also sets the Editor directive.


Tool Bar Dialog

This dialog allows you to define or modify buttons on the tool bar.

Select the button you want to define or modify in the box on the left.

Enter the button's label and the command to be executed when you select the button in the fields at the bottom of the dialog box.  You can enter multiple commands in the Command field by separating them with the command separator character [^].

You can use the Browse button to find a path and filename to be entered at the beginning of the Command field.

Before entering a command to start an application program, be sure to check whether the application must be started in a particular directory.  If so, and you have a .PIF file for the application, the startup directory should be specified there.  Otherwise, you can use a CDD command in the Command field before the application name, for example:

cdd d:\docfiles ^ d:\winword\winword.exe

If the command line begins with an at-sign [@] it will not be added to the command history.  Otherwise, all commands executed from the tool bar are stored in the history.

Use the radio buttons to select how you want the command to be executed:

*	Echo means display the tool bar command on the command line, but do not execute it.  You can add additional text to the line if you wish, then press Enter to execute the command.  This is the default setting.

*	Echo & Execute means display the tool bar command on the command line, then execute it immediately, without waiting for you to press Enter.

*	Execute w/o Echo means execute the tool bar command immediately, without waiting for you to press Enter, and without displaying the command.

The Font Size setting applies to all of the buttons on the tool bar.  If you make the font size too large buttons on the right hand end of the toolbar may not be visible even if the Take Command window is expanded to fill the screen.

If you exit by choosing the OK button, any changes you have made will be saved in the TCMD.INI file, and reloaded automatically the next time you start Take Command.  If you use the Cancel button, your changes will be discarded.


Virtual Machine Setup Dialog

The internal facility used to run DOS applications inside the Take Command window is called "Caveman".  For more details on Caveman see the separate topics on Take Command and DOS Applications and on Caveman.  This dialog allows you to configure the "Virtual Machine" (VM) created by Caveman to run DOS applications and display their output on the Windows screen.

Many of the settings in this dialog are similar to those in a standard PIF file, except that they apply to the Caveman VM.

Changes to the memory and priority settings will not take effect until the next time the Caveman VM Is created (see the Reuse Virtual Machine setting below for details).

The memory Required settings establish the minimum amount of each type of memory that will be allocated to a Caveman VM.  The Wanted field sets the amount of memory you would like to have for the VM, if possible.  Limit settings define the maximum amount of memory of each type which the Caveman VM can use.  If you set the Wanted or Limit field to -1, Caveman will request as much memory as Windows has available.

Windows will retain any memory marked Locked in RAM and not swap it to virtual memory (usually a swap file on your hard disk).  This makes memory access somewhat faster but prevents other applications from using the same physical RAM space.

The Foreground Priority and Background Priority settings establish how much processing time Caveman will receive from Windows.

If you select Run DOS Apps in Caveman VM, Take Command will run DOS applications in the Caveman VM by default.  You can then override the default and force a DOS program to start in a separate window by using the START command, or creating a .PIF file for the application.  If you deselect this option DOS applications will run in a separate window by default.  You can then override the default and start a DOS program under Caveman with the START command's /CM switch.  See Take Command and DOS Applications for complete details on the use of this option.

When Reuse Virtual Machine is selected (the default), the Caveman VM Is created the first time you run a DOS program under Caveman, and destroyed when Take Command exits.  The VM will remain in existence between uses, and subsequent DOS programs will start more quickly.  However, if you select this option, other Windows applications will not be able to use the RAM, virutal memory, and other resources allocated to the Caveman VM, and this may reduce their performance slightly.

If Reuse Virtual Machine is not selected the Caveman VM is restarted for each DOS program.  This will make DOS programs run under Caveman start more slowly, but will free the VM's resources for use by Windows applications when DOS programs are not running.

If you exit by using the Save button, the settings will be saved in your TCMD.INI file and used in future Take Command sessions.  If you exit by using the OK button, any new settings will only remain in effect during the current session.


Caveman Error Dialog

An error has occurred because you tried to run an incompatible DOS program under Caveman.  For details on running DOS programs, including a description of the types of programs which work properly under Caveman, see the Take Command and DOS Applications and Caveman topics.

Select Restart in Separate Window to restart the application now in a separate window (rather than under Caveman).

Select Return to Take Command to return to the Take Command screen without restarting the application.

In either case, if you click the Always use separate window button at the bottom of the screen Take Command will remember that this program will not work under Caveman, and will automatically run it in a separate window the next time you start it.  The list of applications incompatible with Caveman is kept in the [DosApps] section of TCMD.INI.

The Error code shown on the screen may be helpful in explaining why your application does not work under Caveman.  The two most common codes are:

09 00 00	The program  attempted to retrieve keystrokes directly from the keyboard hardware.  Caveman cannot support programs which access the keyboard hardware directly.

10 xx xx	The program tried to use a non-standard video mode (for example, a graphics mode), modify the video font or color palette, or perform other specialized video operations usually associated with full-screen programs.  Caveman is designed for "teletype-style" programs and only supports standard text modes.

21 25 09	The program  attempted to retrieve keystrokes directly from the keyboard hardware (see code 09 00 00 above).


Find Files Dialog
Find Files/Text Dialog

The Find Files/Text dialog box gives you the same features as the FFIND command, in dialog form.

Enter the file name or names you wish search in the Files field.  You can use wildcards and include lists as part of the file name.  To select files from previous searches in the same Take Command session, click on the down arrow beside the Files field, or press the up or down arrow while the input cursor is in the Files field.  You can also use the Browse button to find files to include in the search.

Enter the text or hexadecimal values you are searching for in the Text field.

Enter the drive(s) you want to search in the Disks field.

The Match Case box, when it is selected, makes the search case-sensitive.  The Hex Search option signals that you are searching for hexadecimal values, not ASCII characters.

If you enable All Lines, every line from every file that contains the search text will be displayed.  If this option is not enabled, only the first line from such a file will be displayed.

Unless you enable the Hidden Files option, files with the hidden attribute will not be included in the search.

The radio buttons in the Search area let you specify where you want FFIND to look for files.

To start the search, press the Find button.  Once the search has started the Find button changes to a Stop button, which can use to interrupt the search before it is finished.

Once FFIND has finished searching, you can save the list of matching files with the Export button.

As you move the cursor over the list of matching files, information about each file appears below the file list.  If you select one of the matching files in the list (by double-clicking on it, or selecting it with the cursor and pressing Enter), FFIND will display another dialog with complete directory information about the file.  From that dialog you can Run the file (if it is an executable file, a batch file, or has an executable extension), display the file with the LIST command, or Edit the file.  When you exit from LIST or the editor, the original list of matching files will still be available.


Aliases Dialog

The current list of aliases is shown in the pane on the left of this dialog box.  As you move the cursor in the pane, the name of the alias under the cursor is shown in the Name field and its definition is shown in the Value field.  You can use these fields to edit the alias.

To add a new alias to the list, use the Add button.  The Name and Value fields will be cleared so you can enter new values in each.

The Delete button deletes the highlighted alias.

The Import button reads a list of aliases from a file (similar to the ALIAS /R command).  The Export button writes the current list to a file.

Changes you make in this dialog are not saved in the alias list until you click the OK button.  If you click Cancel the changes are discarded.


Environment Dialog

The current environment variables are shown in the pane on the left of this dialog box.  As you move the cursor in the pane, the name of each entry appears in the Name field and its value appears in the Value field.  You can use these fields to edit the environment entry.

To add a entry to the list, use the Add button.  The Name and Value fields will be cleared so you can enter new values in each.

The Delete button deletes the highlighted environment variable.

The Import button reads a list of environment variables from a file (similar to the SET /R command).  The Export button writes the current list to a file.

Changes you make in this dialog are not saved in the environment until you click the OK button.  If you click Cancel the changes are discarded.


Task List
Windows and Tasks List

The Windows and Tasks List shows the windows and tasks that are currently running.  The Windows list on the left shows the module name and title bar text for each open window.  You can move the cursor to select a window and then double-click on the name or use the Switch To button to activate that window and give it the input focus.

Use the Close Window button to close a window.  Closing a window in this way is similar to double-clicking on the control box in the upper-left corner of the window.  If you close the main window of an application, the application will probably close as well.  The exact behavior of any application when one of its windows is forcibly closed depends on how the application was written, and cannot be controlled by Take Command.

The Tasks list shows the executable file name for each task that is currently running.  If you select a name from this list or use the Info button, an information box will appear with the task's full path and file name, the command line that started the task, the current directory for that task, and the name of the task's parent.  You can close a task with the End Task button.

In most cases the Close Window and End Task buttons have the same effect:  the application ends.  However you may be able to stop an application that has hung with the End Task button, even if the task won't respond to Close Window.  Applications with two or more active tasks may not end (and may hang the system) if you close just one of the tasks.


Conventions

This section contains information about conventions that are used throughout Take Command:

Colors and color names

Color-coded directories

Keys and key names

These topics are combined here so that they will be easy to find when you need to refer to them.  You will find cross references to this section throughout the help system.


Colors and Color Names

You can use color names in several of the directives in the .INI file and in many commands.  The general form of a color name is:

[BRIght] fg ON [BRIght] bg

where fg is the foreground or text color, and bg is the background color.

The available colors are:

Black	Blue	Green	Red

Magenta	Cyan	Yellow	White

Color names and the word BRIght may be shortened to the first 3 letters.

You can also specify colors by number instead of by name.  The numbers are most useful in potentially long INI file directives like ColorDIR.  Take Command recognizes these color numbers:

0 - Black	 8 - Gray (bright black)

1 - Blue	 9 - Bright blue

2 - Green	10 - Bright green

3 - Cyan	11 - Bright cyan

4 - Red	12 - Bright red

5 - Magenta	13 - Bright magenta

6 - Yellow	14 - Bright yellow

7 - White	15 - Bright white

Use one number to substitute for the [BRIght] fg portion of the color name, and a second to substitute for the [BRIght] bg portion.  For example, instead of bright cyan on blue you could use 11 on 1 to save space in a ColorDir specification.


Color-Coded Directories

The DIR command can display each file name in a different color, depending on the file's extension.

To choose the DIR display colors, you must either use the SET command to create an environment variable called COLORDIR, or use the ColorDir directive in your .INI file.  If you do not use the COLORDIR variable or the ColorDir directive, DIR will use the default screen colors.

If you use both the COLORDIR variable and the ColorDir directive, the environment variable will override the settings in your .INI file.  You may find it useful to use the COLORDIR variable for experimenting and then set permanent directory colors with the ColorDir directive.

The format for both the COLORDIR environment variable and the ColorDir directive in the .INI file is:

ext ... :ColorName; ...

where "ext" is a file extension (which may include wildcards) or one of the following file types:

DIRS	Directories

RDONLY	Read-only files

HIDDEN	Hidden files

SYSTEM	System files

ARCHIVE	Files modified since the last backup

and "ColorName" is any valid color name (see Colors).

Unlike most color specifications, the background portion of the color name may be left out for directory colors.  If you don't specify a background color, DIR will use the current screen background color.

For example, to display the .COM and .EXE files in red on the current background, the .C and .ASM files in bright cyan on the current background, and the read-only files in bright green on white (this should be entered on one line):

c:\> set colordir=com exe:red;c asm:bri cyan;rdonly:bri gre on whi

Extended wildcards (for example "BA[KXC]" for .BAK, .BAX, and .BAC files) can be used in directory color specifications.


Keys and Key Names

Key names are used to define keystroke aliases, and in several TCMD.INI directives.  The format of a key name is the same in both uses:

[Prefix-]Keyname

The key prefix can be left out, or it can be any one of the following:

Alt	followed by A - Z, 0 - 9, F1 - F12, or Bksp

Ctrl	followed by A - Z, F1 - F12, Tab, Bksp, Enter, Left, Right, Home, End, PgUp, PgDn, Ins, or Del

Shift	followed by F1 - F12 or Tab.

The possible key names are:

A - Z	Enter	PgDn

0 - 9	Up	Home

F1 - F12	Down	End

Esc	Left	Ins

Bksp	Right	Del

Tab	PgUp

All key names must be spelled as shown.  Alphabetic keys can be specified in upper-case or lower-case.  You cannot specify a punctuation key.

The prefix and key name must be separated by a dash [-].  For example:

Alt-F10	This is okay

Alt F10	The space will cause an error

If you prefer, you can use a numeric value instead of a key name. Use the ASCII code for an ASCII, extended ASCII, or control character.  Use the scan code preceded by an at sign [@] for extended key codes like F1 or the cursor keys.  For example, use 13 for Enter, or @59 for F1.  In general, you will find it easier to use the names described above rather than key numbers.

Some keys are intercepted by Windows and are not passed on to Take Command.  For example, Ctrl-S pauses screen output temporarily, and Ctrl-Esc pops up the Windows tasklist.  Keys which are intercepted by Windows generally cannot be assigned to aliases or with key mapping directives, because Take Command never receives these keystrokes and therefore cannot act on them.

You also may not be able to use certain keys if your keyboard is not 100% IBM-compatible or your keyboard driver does not support them.  For example, on some systems the F11 and F12 keys are not recognized; others may not support unusual combinations like Ctrl-Tab.  These problems are rare; when they do occur, they are usually due to Windows and not to any problem with Take Command.


The Command Line

Take Command displays a c:\> prompt when it is waiting for you to enter a command.  (The actual text depends on the current drive and directory as well as your PROMPT settings.)  This is called the command line and the prompt is asking you to enter a command, an alias or batch file name, or the instructions necessary to begin an application program.

This section explains the features that will help you while you are typing in commands, how keystrokes are interpreted when you enter them at the command line, and how to transfer text between Take Command and other Windows applications.

The keystrokes discussed here are the ones normally used by Take Command.  If you prefer using different keystrokes to perform these functions, you can assign new ones with key mapping directives in the .INI file.

The command line features documented in this section are:

Command-Line Editing

Command History and Recall

Command History Window

Filename Completion

Directory History Window

Automatic Directory Changes

Multiple Commands

Command-Line Length Limits

Page and File Prompts

Conditional Commands

Command Grouping

Escape Character

Critical Errors

Additional command-line features are documented under Redirection and Piping and File Selection.


Command-Line Editing

The command line works like a single-line word processor, allowing you to edit any part of the command at any time before you press Enter to execute it, or Esc to erase it.  The command line extends to a maximum of 255 characters.

You can use the following editing keys when you are typing a command (the words Ctrl and Shift mean to press the Ctrl or Shift key together with the other key named):

Cursor Movement Keys:

←	Move the cursor left one character.

→	Move the cursor right one character.

Ctrl ←	Move the cursor left one word.

Ctrl →	Move the cursor right one word.

Home	Move the cursor to the beginning of the line.

End	Move the cursor to the end of the line.

Insert and Delete Keys:

Ins	Toggle between insert and overstrike mode.

Del	Delete the character at the cursor, or the highlighted text.

Bksp	Delete the character to the left of the cursor, or the highlighted text.

Ctrl-L	Delete the word or partial word to the left of the cursor.

Ctrl-R	Delete the word or partial word to the right of the cursor.

 or Ctrl-Bksp

Ctrl-Home	Delete from the beginning of the line to the cursor.

Ctrl-End	Delete from the cursor to the end of the line.

Esc	Delete the entire line.

Ctrl-C	Cancel the command.

 or Ctrl-Break

Shift-Ins	Insert the text from the clipboard at the current cursor position on the command line.

Ctrl-Shift-Ins	Insert the highlighted text (from anywhere in the window) at the current cursor position on the command line.

Enter	Execute the command line.

To highlight text on the command line use the mouse, or the Shift key in conjunction with the ←, →, Ctrl-←, Ctrl-→, Home, and End keys.  Any new text you type will replace the highlighted text.  If you press Bksp or Del while there is text highlighted on the command line, the highlighted text will be deleted.

While you are working at the Take Command prompt you can also use the Windows clipboard to copy text between Take Command and other applications (see Highlighting and Copying Text for additional details).  You can also use the Windows Drag and Drop facility to paste a filename from another application onto the command line.

Sometimes you may want to enter one of the above keystrokes on the command line instead of performing the key's usual action.  For example, suppose you have a program that requires a Ctrl-R character on its command line.  Normally you couldn't type this keystroke at the prompt, because it would be interpreted as a "Delete word right" command.

To get around this problem, use the special keystroke Alt-255. You enter Alt-255 by holding down the Alt key while you type 255 on the numeric keypad, then releasing the Alt key (you must use the number keys on the numeric pad; the row of keys at the top of your keyboard won't work).  This forces Take Command to interpret the next keystroke literally and places it on the command line, ignoring any special meaning it would normally have as a command- line editing or history keystroke.  You can use Alt-255 to suppress the normal meaning of command-line editing keystrokes even if they have been reassigned with key mapping directives in the .INI file, and Alt-255 itself can be reassigned with the CommandEscape directive.

If you want your input at the command line to be in a different color from Take Command's prompts or output, you can use the InputColors directive in your .INI file.

Most of the command-line editing capabilities are also available when a Take Command command prompts you for a line of input.  For example, you can use the command-line editing keys when DESCRIBE prompts for a file description, when INPUT prompts for input from an alias or batch file, or when LIST prompts you for a search string.


Command History and Recall

Command History Keys:

Ctrl-↑	Recall the previous (or most recent) command, or the most recent command that matches a partial command line.

Ctrl-↓	Recall the next (or oldest) command, or the oldest command that matches a partial command line.

F3	Fill in the rest of the command line from the previous command, beginning at the current cursor position.

Ctrl-D	Delete the currently displayed history list entry, erase the command line, and display the previous matching history list entry.

Ctrl-E	Display the last entry in the history list.

Ctrl-K	Save the current command line in the history list without executing it, and then clear the command line.

@	As the first character in a line:  Do not store the current line in the CMDLINE environment variable.

Use the Ctrl-↑ key repeatedly to scan back through the history list.  When the desired command appears, press Enter to execute it again.  After you have found a command, you can edit it before pressing Enter.

The history list is "circular".  If you move to the last command in the list and then press the down arrow one more time, you'll see the first command in the list.  Similarly, if you move to the first command in the list and then press the up arrow one more time, you'll see the last command in the list.

If you prefer to use the arrow keys to access the command history without having to press Ctrl (as in 4DOS), see the SwapScrollKeys directive in TCMD.INI, or the corresponding option on the Command Line page of the configuration dialogs.  SwapScrollKeys switches the keystroke mapping so that the ↑, ↓, and PgUp keys manipulate the command history, and Ctrl-↑, Ctrl-↓, Ctrl-PgUp, and Ctrl-PgDn are used to control the scrollback buffer.  For more details see Scrolling and History Keystrokes.

You can search the command history list to find a previous command quickly using command completion.

Just enter the first few characters of the command you want to find and press Ctrl-↑. You only need to enter enough characters to identify the command that you want to find.  If you press the Ctrl-↑ key a second time, you will see the previous command that matches.  The system will beep if there are no matching commands.  The search process stops as soon as you type one of the editing keys, whether or not the line is changed.  At that point, the line you're viewing becomes the new line to match if you press Ctrl-↑ again.

You can specify the size of the command history list with the History directive in the .INI file.  When the list is full, the oldest commands are discarded to make room for new ones.  You can also use the HistMin directive in the .INI file to enable or disable history saves and to specify the shortest command line that will be saved.

When you execute a command from the history, that command remains in the history list in its original position.  The command is not copied to the end of the list (unless you modify it).  If you want each command to be copied to the end of the list when it is re- executed, set HistCopy to Yes in your .INI file.


Command History Window

Command History Window Keys:

Ctrl-PgUp	(from the command line) Open the command history window.

  or Ctrl-PgDn

↑	Scroll the display up one line.

↓	Scroll the display down one line.

←	Scroll the display left 4 columns.

→	Scroll the display right 4 columns.

PgUp	(inside the window) Scroll the display up one page.

PgDn	(inside the window) Scroll the display down one page.

Ctrl-PgUp	Go to the beginning of the history list.

  or Home

Ctrl-PgDn	Go to the end of the history list.

  or End

Ctrl-D	Delete the selected line from the history list.

Enter	Execute the selected line.

  or Double Click

Ctrl-Enter	Move the selected line to the command line for editing.

  or Ctrl-Double Click

You can view the command history in a scrollable command history window, and select the command to modify or re-execute from those displayed in the window.  To activate the command history window press Ctrl-PgUp or Ctrl-PgDn at the command line.  A window will appear in the upper right corner of the screen, with the command you most recently executed marked with a highlight. (If you just finished re-executing a command from the history, then the next command in sequence will be highlighted.)

Once you have selected a command in the history window, press Enter or double-click with the mouse to execute it immediately.  Press Ctrl-Enter or hold down the Ctrl key while you double-click with the mouse to move the line to the prompt for editing (you cannot edit the line directly in the history window).

If you prefer to use the PgUp key to access the command history without having to press Ctrl (as in 4DOS), see the SwapScrollKeys directive in TCMD.INI, or the corresponding option on the Command Line page of the configuration dialogs.  SwapScrollKeys switches the keystroke mapping so that the ↑, ↓, and PgUp keys manipulate the command history, and Ctrl-↑, Ctrl-↓, Ctrl-PgUp, and Ctrl-PgDn are used to control the scrollback buffer.  For more details see Scrolling and History Keystrokes.

You can bring up a "filtered" history window by typing some characters on the command line, then pressing PgUp or PgDn. Only those commands matching the typed characters will be displayed in the window.

You can control the position and size of the history window with configuration directives in TCMD.INI, or the corresponding items on the Command Line page of the configuration dialogs.  You can also change the keys used in the window with key mapping directives in the .INI file.


Filename Completion

Filename Completion Keys:

F8	Get the previous matching filename.

  or Shift-Tab

F9	Get the next matching filename.

  or Tab

Ctrl-Shift-Tab	Keep the current matching filename and display the next matching name immediately after the current one.

Filename completion can help you by filling in a complete file name on the command line when you only remember part of the name.  For example, if you know the name of a file begins AU but you can't remember the rest of the name, type:

c:\> copy au

and then press the Tab key or F9 key.  Take Command will search the current directory for filenames that begin AU and insert the first one onto the command line in place of the AU that you typed.

If this is the file that you want, simply complete the command.  If Take Command didn't find the file that you were looking for, press Tab or F9 again to substitute the next filename that begins with AU.  When there are no more filenames that match your pattern, the system will beep each time you press Tab or F9.

If you go past the filename that you want, press Shift-Tab or F8 to back up and return to the previous matching filename. After you back up to the first filename, the system will beep each time you press Shift-Tab or F8.

If you want to enter more than one matching filename on the same command line, press Ctrl-Shift-Tab when each desired name appears.  This will keep that name and place the next matching filename after it on the command line.  You can then use Tab (or F9) and Shift-Tab (or F8) to move through the remaining matching files.

The pattern you use for matching may contain any valid filename characters, as well as wildcard characters and extended wildcards.  For example, you can copy the first matching .TXT file by typing

c:\> copy *.txt

and then pressing Tab.

If you don't specify part of a filename before pressing Tab, the matching pattern will be *.*.  If you type a filename without an extension, Take Command will add *.* to the name.  It will also place a "*" after a partial extension.  If you are typing a group of file names in an include list, the part of the include list at the cursor will be used as the pattern to match.

When filename completion is used at the start of the command line, it will only match directories, executable files, and files with executable extensions , since these are the only file names that it makes sense to use at the start of a command.  If a directory is found, a "\" will be appended to it to enable an automatic directory change.

Filename Completion Window

You can also view filenames in a scrollable filename completion window and select the file you want to work with.  To activate the window, press F7 or Ctrl-Tab at the command line.  You will see a window in the upper-right corner of the screen, with the names of files that match any partial filename you have entered on the command line.  If you haven't yet entered a file name, the window will contain the name of all files in the current directory. (Ctrl-Tab will work only if your keyboard and keyboard driver support it.  If it does not work on your system, use F7 instead.)

Filename Completion Window Keys:

F7	(from the command line)  Open the filename completion window.

  or Ctrl-Tab

↑	Scroll the display up one line.

↓	Scroll the display down one line.

←	Scroll the display left 4 columns.

→	Scroll the display right 4 columns.

PgUp	Scroll the display up one page.

PgDn	Scroll the display down one page.

Ctrl-PgUp	Go to the beginning of the filename list.

  or Home

Ctrl-PgDn	Go to the end of the filename list.

  or End

Enter	Insert the selected filename into the command line.


Directory History Window

Directory History Window Keys:

F6	Open the directory history window.

↑	Scroll the display up one line.

↓	Scroll the display down one line.

←	Scroll the display left 4 columns.

→	Scroll the display right 4 columns.

PgUp	Scroll the display up one page.

PgDn	Scroll the display down one page.

Ctrl-PgUp	Go to the beginning of the directory list.

  or Home

Ctrl-PgDn	Go to the end of the directory list.

  or End

Ctrl-D	Delete the selected line from the directory list.

Enter	Change to the selected drive and directory.

  or Double Click

Ctrl-Enter	Move the selected line to the command line for editing.

  or Ctrl-Double Click

Every time you change to a new directory or drive, the current directory is recorded in an internal directory history.  The length of the directory history is 256 bytes by default; as new entries are added, old entries are deleted from the list.  Directory changes are recorded whether you make them from the command line with the CD, CDD, PUSHD, or POPD commands, with an automatic directory change, or by typing a new drive letter followed by a colon. Directories are recorded whether you change from one to another at the command line, from within a batch file, or from within an alias.  In order to conserve space, each directory name is recorded just once in the directory history, even if you move into and out of that directory several times.

You can view the directory history from the scrollable directory history window and change to any drive and directory on the list. To activate the directory history window, press F6 at the command line.  You can then select a new directory with the Enter key or by double-clicking with the mouse.

You can control the length of the directory history with initialization directives and the size of the window with configuration directives in TCMD.INI.  You can alos use the corresponding items on the Startup and Command Line pages of the configuration dialogs.  You can change the keys used in the window with key mapping directives in the .INI file.


Automatic Directory Changes

The automatic directory change feature gives you a quick method for changing directories.  You can use an automatic directory change in place of the CD or CDD command.  To do so, simply type the name of the directory you want to change to at the prompt, with a backslash [\] at the end.  For example:

c:\> tcmd\

c:\tcmd>

This feature can make directory changes very simple when it's combined with CDPATH, a list of directories for the CD and CDD commands to search if the directory you name does not exist below the current directory.  For example, suppose CDPATH is set to C:\;D:\;E:\, and the directory WIN exists on drive E:.  You can change to this directory with a single word on the command line:

c:\tcmd> win\

e:\win>

In executing the command shown above, Take Command first looks for a WIN subdirectory of the current directory, i.e., C:\Take Command\WIN.  If no such directory exists it looks for a WIN subdirectory in every directory in the CDPATH list, and changes to the first one it finds.

Internally, automatic directory changes use the CDD command, so the text before the backslash can include a drive letter, a full path, or a partial path.  Commands like "....\" can be used to move up the directory tree quickly (see Extended Parent Directory Names). Automatic directory changes save the current directory, so it can be recalled with a "CDD -" or "CD -" command.


Multiple Commands

You can type several commands on the same command line, separated by a caret [^].  For example, if you know you want to copy all of your .TXT files to drive A: and then run CHKDSK to be sure that drive A's file structure is in good shape, you could enter the following command:

c:\> copy *.txt a: ^ chkdsk a:

You may put as many commands on the command line as you wish, as long as the total length of the command line does not exceed 255 characters.

You can use multiple commands in batch files and alias definitions as well as from the command line.

If you don't like using the default command separator, you can pick another character using the SETDOS /C command or the CommandSep directive in the .INI file.  If you plan to share aliases or batch files between 4DOS, 4OS2, 4DOS/NT and Take Command, see 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for details about choosing compatible command separators for two or more products.


Command-Line Length Limits

When you first enter a command at the prompt or in an alias or batch file, it can be up to 255 characters long.

As Take Command scans the command line and substitutes the contents of aliases and environment variables for their names, the line usually gets longer.  This expanded line is stored in an internal buffer which allows each individual command to grow to 255 characters during the expansion process.  In addition, if you have multiple commands on a single line, during expansion the entire line can grow to as much as 511 characters.  If your use of aliases or environment variables causes the command line to exceed either of these limits as it is expanded, you will see an error message and the remainder of the line will not be executed.


Page and File Prompts

Several Take Command commands can generate prompts, which wait for you to press a key to view a new page or to perform a file activity.

When Take Command is displaying information in page mode, for example with a DIR /P or SET /P command, it displays the message

Press Esc to Quit or any other key to continue...

At this prompt, you can press Esc, Ctrl-C, or Ctrl- Break if you want to quit the command.  You can press almost any other key to continue with the command and see the next page of information.

During file processing, if you have activated prompting with a command like DEL /P, you will see this prompt before processing every file:

Y/N/R ?

You can answer this prompt by pressing Y for "Yes, process this file;"  N for "No, do not process this file;" R for "process the Remainder of the files without further prompting; or Esc for "cancel further processing for this argument."  You can also press Ctrl-C or Ctrl-Break at this prompt to cancel the remainder of the command.


Conditional Commands

Conditional commands allow you to perform tasks based upon the previous command's exit code.  Many programs return a 0 if they are successful and a non-zero value if they encounter an error.

If you separate two commands by && (AND), the second command will be executed only if the first returns an exit code of 0.  For example, the following command will only erase files if the BACKUP operation succeeds:

c:\> backup c:\ a: && del c:\*.bak;*.lst

If you separate two commands by || (OR), the second command will be executed only if the first returns a non-zero exit code. For example, if the following BACKUP operation fails, then ECHO will display a message:

c:\> backup c:\ a: || echo Error in the backup!

All internal commands return an exit code, but not all external programs do.  Conditional commands will behave unpredictably if you use them with external programs which do not return an explicit exit code.


Command Grouping

Command grouping allows you to logically group a set of commands together by enclosing them in parentheses.  The parentheses are similar in function to the BEGIN and END block statements in some programming languages.

There are two primary uses for command grouping.  One is to execute multiple commands in a place where normally only a single command is allowed.  For example, suppose you want to copy then rename all the .WKQ files on drives A: and B: using the FOR command.  You could do it like this:

c:\> for %drv in (A B) do copy %drv:*.wkq d:\wksave\

c:\> for %drv in (A B) do ren %drv:*.wkq *.old

But with command grouping you can do the same thing in one command (enter this on one line):

c:\> for %drv in (A B) do (copy %drv:*.wkq d:\wksave\ ^

ren %drv:*.wkq *.sav)

The COPY and REN commands enclosed in the parentheses appear to FOR as if they were a single command, so both commands are executed for every element of the FOR list.

You can also use command grouping to redirect input or output for several commands without repeatedly using the redirection symbols.  For example, consider the following batch file fragment which uses the ECHO command to create a file (with >), and to append to the file (with >>):

echo Data files %_date > filelist

dir *.dat >> filelist

echo. >> filelist

echo Text files %_date >> filelist

dir *.txt >> filelist

Using command grouping, these commands can be written much more simply.  Enter this example on one line:

(echo Data files %_date ^ dir *.dat ^ echo. ^ echo Text files %_date ^ dir *.txt) > filelist

The redirection, which appears outside the parentheses, applies to all the commands within the parentheses.  Because the redirection is performed only once, the commands will run slightly faster than if each command was entered separately.  The same approach can be used for input redirection and for piping.

You can also use command grouping in a batch file or at the prompt to split commands over several lines.  This last example is like the redirection example above, but is entered at the prompt.  Take Command displays a "More?" prompt after each incomplete line:

c:\> (echo Data files %_date

More? dir *.dat

More? echo.

More? echo Text files %_date

More? dir *.txt) > filelist

c:\>


Escape Character

Take Command recognizes a user-definable escape character.  This character gives the following character a special meaning; it is not the same as the ASCII ESC that is often used in ANSI and printer control sequences.

The default escape character is Ctrl-X, which appears in the Take Command window as an up-arrow [↑]. (The appearance of control characters depends on the font you use.  In many fonts the Ctrl-X character is displayed as a "block" or other non-descript character, but the Terminal font used by default in Take Command typically does display this character as an up-arrow.)

If you don't like using the default escape character, you can pick another character using the SETDOS /E command or the EscapeChar directive in your .INI file.  If you plan to share aliases or batch files between 4DOS, 4OS2, 4DOS/NT and Take Command, see 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for details about choosing compatible escape characters for two or more products.

Eight special characters are recognized when they are preceded by the escape character.  The combination of the escape character and one of these characters is translated to a single character, as shown below.  These are useful for redirecting codes to the printer, and ↑r can be used in keystroke aliases.  The special characters which can follow the escape character are:

b	backspace

c	comma

e	the ASCII ESC character (ASCII 27)

f	form feed

n	line feed

r	carriage return

s	space

t	tab character

If you follow the escape character with any other character, the escape character is removed and the second character is copied directly to the command line.  This allows you to suppress the normal meaning of special characters (such as ? * / \ | " ` > < and &).

For example, to send a form feed followed by the sequence ESC Y to the printer, you can use this command:

c:\> echos ↑f↑eY > prn


Critical Errors

Windows watches for physical errors during input and output operations.  Physical errors are those due to hardware problems, such as trying to read a floppy disk while the drive door is open.

These errors are called critical errors because Windows, Take Command, or your application program cannot proceed until the error is resolved.

When a critical error occurs, you will see a popup window asking you to choose an error handling option.  The message comes from Windows, and will typically offer you two choices:

Cancel	Tell the program that the operation failed.  This option returns an error code to Take Command or to the application program that was running when the error occurred.  Take Command generally stops the current command when an operation fails.

Retry	Choose this option if you have corrected the problem.


Redirection and Piping

This section covers redirection and piping.  You can use these features to change how Take Command and some application programs handle input and output.

Internal commands and many external programs get their input from the computer's standard input device and send their output to the standard output device.  Some programs also send special messages to the standard error device.  Normally, the keyboard is used for standard input and the video screen for both standard output and standard error.  Redirection and piping allow you to change these assignments temporarily.

Redirection

Redirection assigns standard input, standard output, and standard error to a device like the printer or serial port, or to a file.

Redirection always applies to a specific command, and lasts only for the duration of that command.  When the command is finished, the assignments for standard input, standard output, and standard error revert to whatever they were before the command.

Here are the standard redirection options supported by Take Command:

< filename	To get input from a file or device instead of from the keyboard

> filename	Redirect standard output to a file or device

>& filename	Redirect standard output and standard error to a file or device

>&> filename	Redirect standard error only to a file or device

To use redirection, place the redirection symbol and filename at the end of the command line, after the command name and any parameters.  For example, to redirect the output of the DIR command to a file called DIRLIST, you could use a command line like this:

c:\> dir /b *.dat > dirlist

You can use both input and output redirection for the same command, if both are appropriate:

c:\> sort < dirlist > dirlist.srt

If you redirect the output of a single internal command like DIR, the redirection ends automatically when that command is done.  If you start a batch file with redirection, all of the batch file's output is redirected, and redirection ends when the batch file is done.  Similarly, if you use redirection at the end of a command group, all of the output from the command group is redirected, and redirection ends when the command group is done.

If you want to append output to the end of an existing file, rather than creating a new file, replace the first ">" in the output redirection symbol with ">>" (use >>, >>&, and >>&>).

When output is directed to a file with >, >&, or >&>, if the file already exists, it will be overwritten.  You can protect existing files by using the SETDOS /N1 command or the NoClobber directive in the .INI file.

When output is appended to a file with >>, >>&, or >>&>, the file will be created if it doesn't already exist. Setting NoClobber will also prevent the creation of a new file.

You can temporarily override the current setting of NoClobber by using an exclamation mark [!] after the redirection symbol. For example, to redirect the output of DIR to the file DIROUT, and allow overwriting of any existing file despite the NoClobber setting:

c:\> dir >! dirout

Redirection is fully nestable.  For example, you can invoke a batch file and redirect all of its output to a file or device.  Output redirection on a command within the batch file will take effect for that command only; when the command is completed, output will revert to the redirected output file or device in use for the batch file as a whole.

You can use redirection to create a zero-byte file.  To do so, enter  >filename as a command, with no actual command before the > character.

Piping

You can create a "pipe" to send the standard output of one command to the standard input of another command:

command1 | command2	Send the standard output of command1 to the standard input of command2

command1 |& command2	Send the standard output and standard error of command1 to the standard input of command2

For example, to take the output of the SET command (which displays a list of your environment variables and their values) and pipe it to the SORT utility to generate a sorted list, you would use the command:

c:\> set | sort

To do the same thing and then pipe the sorted list to the internal LIST command for full-screen viewing:

c:\> set | sort | list /s

The TEE and Y commands are "pipe fittings" which add more flexibility to pipes.

Like redirection, pipes are fully nestable.  For example, you can invoke a batch file and send all of its output to another command with a pipe.  A pipe on a command within the batch file will take effect for that command only; when the command is completed, output will revert to the pipe in use for the batch file as a whole.

If you want to pipe information to a command inside an IFF, use command grouping around the IFF command.  If you do not, piping will affect only the first command after the IFF.


File Selection

Most internal commands (like COPY, DIR, etc.) work on a file or a group of files.  Besides typing the exact name of the file you want to work with, you can use several shorthand forms for naming or selecting files.

The features explained in this section apply to Take Command commands only, and generally can not be used to pass file names to external programs unless those programs were specifically written to support these features.

The file selection features are:

Extended Parent Directory Names

Wildcards

Date, Time, and Size Ranges

Multiple Filenames

Include Lists

Executable Extensions


Extended Parent Directory Names

Take Command allows you to extend the traditional syntax for naming the parent directory, by adding additional [.] characters.  Each additional [.] represents an additional directory level above the current directory.  For example, .\FILE.DAT refers to a file in the current directory, ..\FILE.DAT refers to a file one level up (in the parent directory), and ...\FILE.DAT refers to a file two levels up (in the parent of the parent directory).  If you are in the C:\DATA\FINANCE\JANUARY directory and want to copy the file LETTERS.DAT from the directory C:\DATA to drive A:

C:\DATA\FINANCE\JANUARY> copy ...\LETTERS.DAT A:


Wildcards

Wildcards let you specify a file or group of files by typing a partial filename.  The appropriate directory is scanned to find all of the files that match the partial name you have specified.

There are two wildcard characters, the asterisk [*] and the question mark [?], plus a special method of specifying a range of permissible characters.

An asterisk [*] in a filename means "any zero or more characters in this position."  For example, this command will display a list of all files in the current directory:

c:\> dir *.*

If you want to see all of the files with a .TXT extension, you could type this:

c:\> dir *.txt

If you know that the file you are looking for has a base name that begins with ST and an extension that begins with .D, you can find it this way.  Filenames such as STATE.DAT, STEVEN.DOC, and ST.D will all be displayed:

c:\> dir st*.d*

With Take Command, you can also use the asterisk to match filenames with specific letters somewhere inside the name.  The following example will display any file with a .TXT extension that has the letters AM together anywhere inside its base name.  It will, for example, display AMPLE.TXT, STAMP.TXT, CLAM.TXT, and AM.TXT:

c:\> dir *am*.txt

A question mark [?] matches any single filename character.  You can put the question mark anywhere in a filename and use as many question marks as you need.  The following example will display files with names like LETTER.DOC and LATTER.DAT, and LITTER.DU:

c:\> dir l?tter.d??

The use of an asterisk wildcard before other characters, and of the character ranges discussed below, are enhancements to the standard wildcard syntax, and are not likely to work properly with software other than Take Command.

"Extra" question marks in your wildcard specification are ignored if the file name is shorter than the wildcard specification.  For example, if you have files called LETTER.DOC, LETTER1.DOC, and LETTERA.DOC, this command will display all three names:

c:\> dir letter?.doc

The file LETTER.DOC is included in the display because the "extra" question mark at the end of "LETTER?" is ignored when matching the shorter name LETTER.

In some cases, the question mark wildcard may be too general.  You can also specify what characters you want to accept (or exclude) in a particular position in the filename by using square brackets. Inside the brackets, you can put the individual acceptable characters or ranges of characters.  For example, if you wanted to match LETTER0.DOC through LETTER9.DOC, you could use this command:

c:\> dir letter[0-9].doc

You could find all files that have a vowel as the second letter in their name this way.  This example also demonstrates how to mix the wildcard characters:

c:\> dir ?[aeiouy]*.*

You can exclude a group of characters or a range of characters by using an exclamation mark [!] as the first character inside the brackets.  This example displays all filenames that are at least 2 characters long except those which have a vowel as the second letter in their names:

c:\> dir ?[!aeiouy]*.*

The next example, which selects files such as AIP, BIP, and TIP but not NIP, demonstrates how you can use multiple ranges inside the brackets.  It will accept a file that begins with an A, B, C, D, T, U, or V:

c:\> dir [a-dt-v]ip

You may use a question mark character inside the brackets, but its meaning is slightly different than a normal (unbracketed) question mark wildcard.  A normal question mark wildcard matches any character, but will be ignored when matching a name shorter than the wildcard specification, as described above.  A question mark inside brackets will match any character, but will not be discarded when matching shorter filenames.  For example:

c:\> dir letter[?].doc

will display LETTER1.DOC and LETTERA.DOC, but not LETTER.DOC.  A pair of brackets with no characters between them [], or an exclamation point and question mark together [!?],will match only if there is no character in that position.  For example,

c:\> dir letter[].doc

will not display LETTER1.DOC or LETTERA.DOC, but will display LETTER.DOC.  This is most useful for commands like

c:\> dir /I"[]" *.btm

which will display a list of all .BTM files which don't have a description.

You can repeat any of the wildcard characters in any combination you desire within a single file name.  For example, the following command lists all files which have an A, B, or C as the third character, followed by zero or more additional characters, followed by a D, E, or F, followed optionally by some additional characters, and with an extension beginning with P or Q.  You probably won't need to do anything this complex, but we've included it to show you the flexibility of extended wildcards:

c:\> dir ??[abc]*[def]*.[pq]*


Date, Time, and Size Ranges

Most internal commands which accept wild cards also allow date, time, and size ranges to further define the files that you wish to work with.  Take Command will examine the files' time stamps (which record when the file was last modified), and the files' sizes, to determine which files meet the range criteria that you specify.

A range begins with the switch character (/), followed by a left square bracket ("[") and a character that specifies the range type:  "s" for a size range, "d" for a date range, or "t" for a time range.  The "s", "d", or "t" is followed by a start value, and an optional comma and end value.  The range ends with a right square bracket ("]").

See the individual range types for details on specifying ranges:

Size Ranges

Date Ranges

Time Ranges

Using Ranges

If you combine two types of ranges, a file must satisfy both ranges to be included.  For example, /[d2-8-94,2-9-94] /[s1024,2048] means files last modified between February 8 and February 9, 1994, which are also between 1,024 and 2,048 bytes long.

When you use a date, time, or size range in a command, it should immediately follow the command name.  Unlike some command switches which apply to only part of the command line, the range usually applies to all file names specified for the command.  Any exceptions are noted in the descriptions of individual commands.

For example, to get a directory of all the *.C files dated October 1, 1994, you could use this command:

c:\> dir /[d10-1-94,+0] *.c

To delete all of the 0-byte files on your hard disk, you could use this command:

c:\> del /[s0,0] *.* /s

And to copy all of the non-zero byte files that you changed yesterday or today to your floppy disk, you can use this command:

c:\> copy /[d-1] /[s1] *.* a:

Date, time, and size ranges can be used with the ATTRIB, COPY, DEL, DESCRIBE, DIR, EXCEPT, FFIND, FOR, LIST, MOVE, RD, REN, SELECT, and TYPE commands. They cannot be used with filename completion or in filename arguments for variable functions.


Size Ranges

Size ranges simply select files whose size is between the limits given.  For example, /[s10000,20000] selects files between 10,000 and 20,000 bytes long.

Either or both values in a size range can end with "k" to indicate thousands of bytes, "K" to indicate kilobytes (1,024 bytes), "m" to indicate millions of bytes, or "M" to indicate megabytes (1,048,576 bytes).  For example, the range above could be rewritten as /[s10k,20k].

All ranges are inclusive.  Both examples above will match files that are exactly 10,000 bytes and 20,000 bytes long, as well as all sizes in between.

The second argument of a size range is optional.  If you use a single argument, like /[s10k], you will select files of that size or larger.  You can also precede the second argument with a plus sign [+]; when you do, it is added to the first value to determine the largest file size to include in the search.  For example,  /[s10k,+1k] select files from 10,000 through 11,000 bytes in size.

Some further examples of size ranges:

Specification	Selects Files

/[s0,0]	of length zero(empty)

/[s1M]	1 megabyte or more in length

/[s10k,+200]	between 10,000 and 10,200 bytes


Date Ranges

Date ranges select files that were created or last modified at any time between the two dates.  For example, /[d12-1-94,12-5-94] selects files that were last modified between December 1, 1994, and December 5, 1994.

The time for the starting date defaults to 00:00:00 and the time for the ending date defaults to 23:59:59.  You can alter these defaults, if you wish, by including a start and stop time inside the date range.  The time is separated from the date with an at sign [@].  For example, the range /[d7-1-94@8:00a,7-3-94@6:00p] selects files that were modified at any time between 8:00 am on July 1, 1994 and 6:00 PM on July 3, 1994.  If you prefer, you can specify the times in 24-hour format (e.g., @18:00 for the end time in the previous example).  The date format and the separator character used in the time may vary depending upon your country information.

If you omit the second argument in a date range, Take Command substitutes the current date and time.  For example, /[d10-1-94] selects files dated between October 1, 1994 and today.

You can use an offset value for either the beginning or ending date, or both.  An offset begins with a plus sign [+] or a minus sign [-] followed by an integer.  If you use an offset for the second value, it is calculated relative to the first.  If you use an offset for the first (or only) value, the current date is used as the basis for calculation.  For example:

Specification	Selects Files

/[d10-27-94,+3]	modified between 10-27-94 and 10-30-94

/[d10-27-94,-3]	modified between 10-24-94 and 10-27-94

/[d-0]	modified today (from today minus zero days, to today)

/[d-1]	modified yesterday or today (from today minus one day, to today)

/[d-1,+0]	modified yesterday (from today minus one day, to zero days after that)

You cannot use offsets in the time portion of a date range (the part after an at sign), but you can combine a time with a date offset.  For example, /[d12-8-94@12:00,+2@12:00] selects files that were last modified between noon on December 8 and noon on December 10, 1994.  Similarly, /[d-2@15:00,+1] selects files last modified between 3:00 PM the day before yesterday and the end of the day one day after that, i.e., yesterday.  The second time defaults to the end of the day because no time is given.


Time Ranges

A time range specifies a file modification time without reference to the date.  For example, to select files modified between noon and 2:00 PM on any date, use /[t12:00p,2:00p].  The times in a time range can either be in 12-hour format, with a trailing "a" for AM or "p" for PM, or in 24-hour format.

If you omit the second argument in a time range, you will select files that were modified between the first time and the current time, on any date.  You can also use offsets, beginning with a plus sign [+] or a minus sign [-] for either or both of the arguments in a time range.  The offset values are interpreted as minutes.  Some examples:

Specification	Selects Files

/[t12:00p,+120]	modified between noon and 2:00 PM on any date

/[t-120,+120]	modified between two hours ago and the current time on any date

/[t0:00,11:59]	modified in the morning on any date

The separator character used in the time may vary depending upon your country information.


Multiple Filenames

Most file processing commands can work with multiple files at one time.  To use multiple file names, you simply list the files one after another on the command line, separated by spaces.  You can use wildcards in any or all of the filenames.  For example, to copy all .TXT and .DOC files from the current directory to drive A, you could use this command:

c:\> copy *.txt *.doc a:

If the files you want to work with are not in the default directory, you must include the full path with each filename:

c:\> copy a:\details\file1.txt a:\details\file1.doc c:

Multiple filenames are handy when you want to match a group of files which cannot be defined with a single filename and wildcards.  They let you be very specific about which files you want to work with in a command.

When you use multiple filenames with a command that expects both a source and a destination, like COPY or MOVE, be sure that you always include a specific destination on the command line.  If you don't, the command will assume that the last filename is the destination and may overwrite important files.

Like extended wildcards and include lists, the multiple filename feature will work with internal commands but not with external programs, unless those programs have been written to handle multiple file names on the command line.

If you have a list of files to process that's too long to put on the command line or too time-consuming to type, see the SELECT command for another way of passing multiple file names to a command.


Include Lists

Any internal command that accepts multiple filenames will also accept one or more include lists.  An include list is simply a group of filenames, with or without wildcards, separated by semicolons [;].  All files in the include list must be in the same directory.  You may not add a space on either side of the semicolon.

For example, you can shorten this command which uses multiple file names:

c:\> copy a:\details\file1.txt a:\details\file1.doc c:

to this using an include list:

c:\> copy a:\details\file1.txt;file1.doc c:

Multiple filenames and include lists are processed differently by the DIR and SELECT commands. If you use multiple filenames, all of the files matching the first filename are processed, then all of the files matching the second name, and so on.  When you use an include list, all files that match any entry in the include list are processed together, and will appear together in the directory display or SELECT list.  You can see this difference clearly if you experiment with both techniques and the DIR command.  For example,

c:\> dir *.txt *.doc

will list all the .TXT files with a directory header, the file list, and a summary of the total number of files and bytes used.  Then it will do the same for the .DOC files.  However,

c:\> dir *.txt;*.doc

will display all the files in one list.

Like extended wildcards and multiple filenames, the include list feature will work with internal commands, but not with external programs (unless they have been programmed especially to support it).


Executable Extensions

Normally, when you type a filename (as opposed to an alias or internal command name) as the first word on the command line, Take Command looks for a file with that name to execute.  The file's extension may be .EXE or .COM to indicate that it contains a program, or it may have a batch file extension like .BTM.

You can add to this default list of extensions, and have Take Command take the action you want with files that are not executable programs or batch files.  The action taken is always based on the file's extension.  For example, you could start your text editor whenever you type the name of a .DOC file, or start your database manager whenever you type the name of a .DAT file.

Take Command reads the file associations that you have defined in Windows and uses each as an executable extension.  In addition, you can use environment variables to define the internal command, external program, batch file, or alias to run for each defined file extension.  To create an executable extension for use only in Take Command, use the SET command to create a new environment variable.  An environment variable is recognized as an executable extension if its name begins with a period.

The syntax for creating an executable extension is:

set .ext=command [options]

This tells Take Command to run the specified command whenever you name a file with the extension .ext at the prompt.  .EXT is the executable file extension; command is the name of the internal command, external program, alias, or batch file to run; and [options] are any command-line startup options you want to specify for the program, batch file, or alias.

For example, if you want to run a word processor called EDITOR whenever you type the name of a file that has an extension of .EDT, you could use this command:

c:\> set .edt=c:\edit\editor.exe

If the command specified in an executable extension is a batch file or external program, Take Command will search the PATH for it if necessary.  However, you can make sure that the correct program or batch file is used, and speed up the executable extension, by specifying the full name including drive, path, filename, and extension.

To remove an executable extension, use the UNSET command to remove the corresponding variable.  To disable a Windows file association within Take Command, use UNSET with a period before the extension (see Windows File Associations for additional details).

Once an executable extension is defined, any time you name a file with that extension the corresponding program, batch file, or alias is started, with the name of your file passed to it as a parameter.

The following example defines QBASIC.EXE as the processor for .BAS files:

[c:\] set .bas=c:\dos\qbasic.exe /run

With this definition, if you have a file named PUSHCART.BAS in the current directory and enter the command:

[c:\] pushcart

Take Command will execute the command:

c:\dos\qbasic.exe /run pushcart.bas

This example defines B.EXE (the Brief text editor) as the processor for .C files:

c:\> set .c=c:\brief\b.exe -Mxyz

Now, if you have a file called HELLO.C and enter the command

c:\> hello -i30

This will be expanded to:

c:\brief\b.exe -Mxyz hello.c -i30

Notice that the text from the .C environment variable is inserted at the beginning of the line, including any options, followed by the original file name plus its extension, and then the remainder of the original command line.

In order for executable extensions to work, the command, program, batch file, or alias must be able to interpret the command line properly.  For example, if a program you want to run doesn't accept a file name on its command line as shown in these examples, then executable extensions won't work with that program.

Executable extensions may include wildcards, so you could, for example, run your text editor for any file with an extension beginning with T by defining an executable extension called .T*.  Extended wildcards (e.g., DO[CT] for .DOC and .DOT files) may also be used.


Using a Windows Command Line

Take Command is a new environment that lets you perform tasks easily under Windows.  You can use it to execute commands, start applications, and perform other work at the command line.

In the past you may have accomplished some of these tasks by starting a Windows session to run 4DOS, JP Softwares replacement command processor for DOS.  Or you may have used an MS-DOS Prompt session to run the default DOS command processor (COMMAND.COM) under Windows.

In either case -- and especially if you are an experienced user of 4DOS -- youll find plenty of familiar features in Take Command.  Youll also find a lot thats new and different.

While Take Command includes most of the command-line, batch file, and other capabilities provided by 4DOS, and goes well beyond those provided by COMMAND.COM, the Windows environment places some limitations on how Take Command operates.

These limitations mostly affect the use of external programs, especially DOS programs.  This topic is covered in detail under Take Command and DOS Applications.  You can use Take Command without going over these details; however you should read through them before changing Take Commands default options for starting DOS programs (for example, those in the VM Setup dialog on the Options menu).

There are some other minor differences between using Take Command and using a 4DOS (or COMMAND.COM) session under Windows (for example, some keystrokes are interpreted differently to conform more closely to Windows conventions).  There are also some considerations when running batch files or 4DOS aliases designed to work under DOS in a Windows program like Take Command.  All of these differences are covered in more detail under Take Command for 4DOS Users.

Take Command also offers a wide range of new Windows-related features which are not available in 4DOS or COMMAND.COM sessions, including:

*	A built-in scrollback buffer  that lets you look back through the output from past commands.

*	A standard Windows menu bar for access to many commonly-used Take Command features.

*	A status bar showing memory and resource usage.

*	A customizable tool bar that gives you quick access to commands and applications.

*	Windows dialogs (accessible from the Options and Utilities menus) for editing environment variables, aliases, file descriptions, and startup parameters.

*	Direct access to Program Manager groups through the Apps menu.

*	High-speed, dialog-based file and text search (see "Find Files/Text" on the Utilities menu).  The new FFIND command gives you the same capabilities at the Take Command prompt.

*	Commands like ACTIVATE, MSGBOX, and QUERYBOX that allow you to use Windows features and control Windows applications from your batch files.

*	A new technology, called "Caveman," which you can use to run many DOS utilities in the Take Command window (see Take Command and DOS Applications for details).


Starting Windows Applications

Take Command offers several ways to start Windows applications.

First, you can simply type the name of any Windows application at the Take Command prompt.  As long as the application's executable file is in one of the standard search directories (see below), Take Command will find it and start it.  If you type the full path name of the executable file at the prompt the application will be started even if it is not in one of the standard search directories.

Take Command offers two methods to simplify and speed up access to your Windows applications.  One is to create an alias, for example:

c:\> alias myapp d:\apps\myapp.exe

You can also use the Tool Bar to start frequently-used applications.  For example, a tool bar button named MyApp which invokes the command d:\apps\myapp.exe would accomplish the same thing as the alias shown above.

You can use these methods together.  For example, if you define the alias shown above you can set up a tool bar button called MyApp and simply use the command myapp, which would then invoke the previously-defined alias.

You can start any application defined in a Program Manager group using the corresponding selection on the Apps Menu.

You can also start a Windows application by typing the name of a data file associated with the application.  Take Command will examine the file's extension and run the appropriate application, based on Windows file associations (see your Windows documentation for details) or on Take Command executable extensions.

For additional flexibility, you can also start applications with the START command.  START provides a number of switches to customize the way an application is started.

Searching for Applications

When you start an application without specifying a path, Take Command searches for the application in the current directory, the Windows directory, the Windows system directory, and then all directories on the PATH.  (If you do enter an explicit path, Take Command will only look in the directory you specified.)

If you enter a file name with no extension, Take Command will search each directory for a matching .COM, .EXE, .BTM, or .BAT file, then for a file matching a Windows file association or Take Command executable extension.  If no such file is found Take Command will move on to the next directory in the search sequence.

This is the same search order used by Windows components like Program Manager, and is similar to the search order used in DOS, with the addition of the Windows and Windows system directories.

Waiting for Applications to Finish

When you start a Windows application from the prompt or a batch file, Take Command does not wait for the application to finish before returning to the prompt.  This allows you to continue your work in Take Command while the application is running.  You can change this default behavior for applications started from the prompt, using the ExecWait option in TCMD.INI, or the External Programs option on the Options 2 page of the configuration dialogs.  These options do not affect batch files; Take Command always waits for applications started from batch files.

You can also force Take Command to wait for an application to finish with the START command with the /WAIT switch.  START can also control many other aspects of how your applications are started.

Passing the Environment to Applications

Take Command normally does not pass its environment to Windows applications.  For example, if you have a Windows program which uses the TEMP environment variable, and you modify this variable within Take Command, the application will not be affected.  Instead, it will inherit the value of TEMP that was set in DOS, before Windows started.

You can force Take Command to pass the environment to Windows applications by using START /E to start the application program.  However, due to a long-standing bug in Windows, your application may not start properly using this method (which is why it is not the default).  Typically the bug causes Take Command to return to the prompt quickly, and the application never starts.  In most cases you can work around the bug by varying the size of the environment by a few bytes, for example by adding one or two short "dummy" variables with the SET command:

c:\> set dum1=aaa

c:\> set dum2=bbb

Some experimentation may be required to determine what works for a particular application, and the requirements may change depending on your system configuration, the applications you have run recently, or Windows' internal state.


Take Command and DOS Applications

This topic and those following it explain in detail how Take Command works with your DOS applications.  You can use Take Command without going over these details; however you should read through them before changing Take Commands default options for starting DOS programs (for example, those in the VM Setup dialog on the Options menu).  The same information is available in Chapter 3 of the Take Command Introduction and Installation Guide if you prefer to read it on paper rather than on the screen.

When you start an external program under Windows it normally runs in its own window, which opens when the program starts and closes when it exits.  You can also start a DOS program inside a 4DOS or MS-DOS Prompt session, and the program will run within that session.

In its default configuration Take Command conforms to these norms.  Whether you start a DOS or Windows program, the program will be assigned its own window, and that window will close when the program exits.  When a DOS program is started in this way Take Command will wait for the program to exit before continuing, just as 4DOS would.

However this approach does not work well for command-line programs which display their output to the screen and then exit.  As soon as the program exits, its window closes and the output is lost!  To make it easier to use this type of program from within Windows, Take Command includes a new technology, Caveman, which  allows DOS programs to run within the Take Command window.

Due to limitations in the way DOS programs can operate under Windows, the techniques used by Caveman do not work well with all programs.  The following topics tell you how to set up your system to make the best use of Take Command and Caveman for running DOS applications:

Starting DOS Applications

Caveman Default

Separate Window Default

Caveman (technical information)


Starting DOS Applications

This section explains in detail the two primary methods for starting DOS programs under Take Command.  For a general description of how DOS applications run under Take Command see the previous topic, Take Command and DOS Applications.

One way to run a DOS application under Take Command is to start it inside the Take Command window, using Caveman.  This offers a quick, easy, and seamless way to run DOS utilities without starting a separate window.  However, it works only for simple DOS utilities which perform standard input and output.  It generally cannot be used for major DOS applications like word processors, spreadsheets, and databases, and its performance and compatibility will be limited with other applications.

Caveman is normally installed when you install Take Command.  It runs only in Windows 386 Enhanced mode; if you start Windows in Standard mode, you cannot use Caveman (you can determine the mode in which Windows was started from the Program Managers Help / About menu selection).  For more information on Caveman, including manual installation instructions and a more detailed description of how Caveman works, see the separate Caveman topic.

The second way to run a DOS program under Take Command is to start it in a separate DOS window.  This is the same method used by Program Managers File / Run menu option, and the similar options offered by other Windows shells.  Any DOS application can be run using this method, but it may not work well for command-line utilities because the window is likely to close before you have a chance to read the output.

Each method will be appropriate for some DOS applications on your system, but not useful or even impossible to use for others.  Unfortunately, Take Command cannot determine automatically which method is best for any given application.  Therefore, you must select the best default method for the particular mix of DOS programs you run from within Take Command.  You can then use .PIF files, aliases or other Take Command or Windows features to force the use of the other method for the specific applications that require it.

If you want to see how these two methods work, first make sure Caveman is installed.  Look at the VM Setup choice on the Options menu.  If this choice is grayed out and cannot be selected then Caveman is not installed, or you did not start Windows in 386 Enhanced mode.  If Caveman is not installed, install it and restart Windows (see the Caveman topic for manual installation instructions).

To try a DOS program with and without Caveman, start it with the START command.  Use the /CM switch to start the program under Caveman, or leave the switch off to start the program in a separate window.  For example:

c:\> start /cm pkunzip	Uses Caveman

c:\> start pkunzip	Uses a separate window

(There are easier ways to start DOS programs directly from the Take Command prompt, but this is the best method to use while youre experimenting.)

When you start a program under Caveman its output will appear in the Take Command window.  When you start the same program in a separate window, its output will appear in that window.  In either case, the program will return to the Take Command prompt when its finished.

Theres no point in starting your word processor, spreadsheet, or communications program under Caveman -- they almost certainly wont work, and if they do theyll be pretty slow.  Use the technique described above to experiment with simple DOS programs like PKUNZIP, XCOPY, or other similar utilities.  See the separate Caveman topic for more details on the kinds of applications which are likely to work properly under Caveman.

 Caveman does its best to detect incompatible applications (for example, those that attempt to manipulate the keyboard hardware, or use unusual video modes) and terminate them gracefully.  If a compatibility problem is detected, youll see a Caveman Error dialog explaining that the program cannot work properly under Caveman.  Click Cancel to terminate the program at this point, or Restart to restart it in a separate window.  Click Always use Separate Window to request that the application be marked as incompatible with Caveman, so that it will be run in a separate window in the future (the mark is stored in TCMD.INI; your application itself is not affected).

 Once you have worked with Caveman a bit you can select a default method for starting DOS applications.  The method you select will be used automatically when you type the name of a DOS program at the command line or in a batch file.  You can then use aliases, .PIF files, or the START command to start specific applications using a method other than the default.  For complete details, see the next two topics:  Caveman Default and Separate Window Default.

To select the default method, open the VM Setup dialog, accessible from the Options menu.  Check the Run DOS Apps in Caveman checkbox if you want DOS programs to run under Caveman by default.  Uncheck the box if you want DOS programs to run in a separate window by default.


Caveman Default

This section explains in detail how to configure your system with Caveman as the default method for starting DOS programs under Take Command.  For a general description of how DOS applications run under Take Command see the previous topics, Take Command and DOS Applications and Starting DOS programs.

Under this method for starting DOS programs, Take Command assumes that DOS applications started from the command line or a batch file should be run under Caveman (for example, if Caveman is the default and you enter the FORMAT command, Take Command will run the FORMAT program under Caveman).

You must then create a .PIF file for each application you dont want to run under Caveman.  When you start a DOS application and Take Command finds the corresponding .PIF file, it will ignore Caveman and run the program in a separate window.

Use this method if you typically run a small number of major DOS applications from Windows, and most of the other DOS programs you want to start from the Take Command prompt fall into the simple utilities category.

Simple utilities are programs like PKZIP, XCOPY, FORMAT, and other programs which display basic teletype-style scrolling output, without significant use of popup windows, full-screen displays, or direct access to your systems hardware devices.

To set up this method, open the VM Setup dialog (accessible from the Options menu), check the Run DOS Apps in Caveman box, and click on the Save as Defaults button.

 Next, establish a .PIF file for each of your major DOS applications.  You can do this with the Windows PIF editor.  To start the PIF editor from the Take Command prompt, change to the Windows directory and enter the command PIFEDIT followed by the application name.  For example:

c:\> cd windows

c:\windows> pifedit wp

This will create a .PIF file with the same name as the DOS application program.  You should enter the appropriate path, filename, working directory, and other parameters from within the PIF editor, then save the file.  See your Windows documentation for additional details on PIF files and PIFEDIT.

You may find that you already have some of the .PIF files you need, because it is not unusual to use them for major DOS applications even when Take Command and Caveman are not running.  If a .PIF file already exists and the corresponding application runs properly, you dont need to make any changes to the file -- it will work as-is with Take Command.

If you try to start a program under Caveman and a separate window is started instead, its probably because you already have a .PIF file defined for that program.  You can remove the .PIF file if you wish, but in many cases programs that already have a .PIF file must be started with that .PIF file in order to work properly.  Therefore its probably best to leave existing .PIF files alone unless you know why they were created and are confident that you can remove them without causing problems.

Once the .PIF files are set up, you can simply type the name of a DOS application at the Take Command prompt.  The major applications for which you have defined .PIF files will be run in separate windows, and your other DOS utilities will run inside the Take Command window, using Caveman.

 If you dont want to use .PIF files, you can accomplish the same thing using aliases.  Simply define an alias for each major DOS application, using the START command to start the application.  For example:

alias wp start d:\wp60\wp.exe

Like a .PIF file, the use of START will force Take Command to ignore Caveman and start the application in a separate window.

The benefit of the Caveman Default approach is that you can run DOS utilities right in the Take Command window without any special commands or aliases to set up.  All you have to do is create a few .PIF files or aliases for your major DOS applications.

The drawback to this approach is that you may try to start an application which wont work well under Caveman, but for which you have neglected to define a .PIF file or alias.  The fact that the Take Command prompt looks so much like a 4DOS or COMMAND.COM DOS prompt can make it easy to make this error.  This isnt likely to cause too much trouble  you can always terminate an application if you make a mistake, and then set up a .PIF file or alias for it  but youll need to be aware of the possibility as you use Take Command.


Separate Window Default

This topic explains in detail how to configure your system with Caveman disabled, so that sepaarate windows are used automatically when starting DOS programs under Take Command.  For a general description of how DOS applications run under Take Command see the previous topics, Take Command and DOS Applications and Starting DOS programs.

Under this method of starting DOS applications, Take Command assumes that DOS applications should be run in a separate window (for example, if a separate window is the default and you enter the FORMAT command, Take Command will ignore Caveman and run the FORMAT program in its own window).  You must then create an alias for each application you do want to run under Caveman.

Use this method if you typically run many significant DOS applications from Windows, and only a few other simple utilities.

To set up this method, open the VM Setup dialog (accessible from the Options menu), remove any check mark in the Run DOS Apps in Caveman box, and click on the Save as Defaults button.

Next, create an alias for each of the DOS utilities you want to run under Caveman.  Use the START /CM command to run the program under Caveman.  For example:

alias pkunzip start /cm c:\util\pkunzip.exe

This alias will force Take Command to run the program under Caveman.  You must create a separate alias for each utility you want to run under Caveman (unless you want to type the START /CM command each time you run the program).

The benefit of the Separate Window Default approach is that you can run any DOS application from the command line or a batch file, without thinking about whether it is the type of application that works well with Caveman.

The drawback to this approach is that you must explicitly create an alias for each utility you want to run under Caveman.  This can mean creating a large number of aliases, and you will lose the benefits of the simple, seamless approach that Caveman offers if you dont remember to create an alias for a particular utility.  Programs for which you forget to create an alias will run in their own window, and may exit before you have a chance to view their output.


Caveman

This topic gives a technical description of Caveman, Take Command's facility for running DOS programs inside the Take Command window.  For a more general description of how DOS applications run under Take Command see the previous series of topics, beginning with Take Command and DOS Applications.

If your system is configured and working properly based on the information in the previous topics, you can feel free to skip this topic altogether, or come back to it later when you want more detail.

Caveman is so named because it does all its work hidden in a cave -- an invisible DOS session -- and is not directly visible to you.  Caveman creates the hidden DOS session for you, captures screen output from your DOS programs, and displays it in the Take Command window.  It also accepts input from the Take Command window and routes it back to the DOS program.

Caveman consists of a Windows virtual device (VxD), stored in the file CAVEMAN.386 and loaded when Windows starts.  In order to use Caveman you must have the following statement in the [386Enh] section of the Windows SYSTEM.INI file:

device=d:\path\caveman.386

where d:\path refers to the drive and directory where Take Command is stored.  This statement is normally added to SYSTEM.INI by the Take Command installation program; if necessary, you can add it (or remove it) yourself with Windows SysEdit, Notepad, or any other ASCII file editor (when you edit SYSTEM.INI, you must restart Windows for your changes to take effect).  The position of this line within SYSTEM.INI is not important as long as it is in the proper section.

Caveman can be used in Windows 3.1 and above (including Windows for Workgroups).  It will not work with IBMs WIN-OS/2, because WIN-OS/2 does not currently support the use of VxDs.  Since OS/2 provides other methods for starting DOS applications, this is not likely to be a problem.

Virtual devices like CAVEMAN.386 can only be loaded when Windows is running in 386 Enhanced mode.  If you start Windows in Standard mode, Caveman will not be loaded (even if you include it in SYSTEM.INI).

A DOS application run from the Take Command prompt, either directly or through an alias or batch file, will be started in the invisible DOS session maintained by Caveman unless one of the following conditions is met:

*	you have a defined a .PIF file for the application; or

*	you use the START command (without the /CM switch) to start the application; or

*	the application has been "marked" as one which requires a separate DOS session; or

*	Caveman is not selected as the default method for running DOS programs; or

*	Caveman is disabled or CAVEMAN.386 is not loaded.

If any of these conditions are met, the application will be run in a separate DOS window, not under Caveman.

All output from an application run under Caveman will appear in the Take Command window, and all input requested by the program will be entered in that window.

Input and output requests from a DOS program must be passed back and forth between Caveman and Take Command.  While this process is relatively fast, programs which poll the keyboard very rapidly to see if input is ready may run more slowly under Caveman than they do outside of Windows.  Programs which generate large amounts of output can also run slightly more slowly.  In most cases these effects will not be particularly noticeable.

Caveman works best with, and is intended for, TTY-style programs which display simple, scrolling output -- for example, programs like the DOS FORMAT and XCOPY utilities, or the popular PKZIP and PKUNZIP file compression programs.  In most cases, this is the only type of program you should run under Caveman -- other DOS applications should be started with a .PIF file, or with an alias which invokes the START command (see Caveman Default for an example), rather than trying to make them work under Caveman.

Some programs which use popup windows and full-screen displays do work under Caveman.  For example, some DOS directory change utilities will pop up a window with a list of directories if you enter a partial directory name; otherwise they simply change the directory and exit.  Utilities like this, which make limited use of popups or full-screen displays, typically are compatible with Caveman.

More complex full-screen DOS programs which write large amounts of data directly to video memory (for example, ASCII editors or file viewers) may work with Caveman, but their performance will be limited, especially if they update the screen frequently or in large blocks.

Programs which display graphics, modify the screen font or perform other unusual video functions, access the keyboard or other hardware directly, or use special or undocumented methods of accessing memory, will not work at all with Caveman.

Most memory-resident (TSR) programs also will not work properly under Caveman.  TSRs loaded before starting Windows should not interfere with Caveman, but you should not attempt to load new DOS TSRs from the Take Command prompt or via START /CM.

Caveman does not provide access to the mouse for DOS programs, and will always inform DOS programs that no mouse is installed.  If you have a DOS program which requires a mouse it must be run in a separate DOS window.

Caveman does its best to detect incompatible programs.   When a program attempts an operation which cant be handled through Caveman, Take Command will display the Caveman Error dialog.  If you click Always use Separate Window the application will be marked as incompatible with Caveman, and will nto be run automatically under Caveman again.  When an application is marked in this way its full path and name are stored in the [DOSApps] section of TCMD.INI.   If the application is moved to a different drive and directory, the mark will be lost and will have to be recreated the next time the application is run.

If Take Command does hang or behave improperly when you start a DOS application using Caveman, you can terminate the DOS application with the End DOS app in Caveman option on the Apps menu.  In extreme cases you can also close Take Command entirely by double-clicking the box on the upper left corner of the window.  To work around a problem with a DOS program, create a .PIF file or alias for the application as described under Cavemman Default.


Take Command for 4DOS Users

If youre a 4DOS user, many of the features in Take Command will seem very familiar.  Because the underlying command processing in Take Command is based on 4DOS, youll find the features of 4DOS are readily accessible.  All the commands and switches youve used in 4DOS work the same way and have the same meaning in Take Command; the only exceptions are those that dont make sense in the Windows environment.

Other 4DOS features are included in Take Command as well -- youll find support for command line editing, command and directory histories, aliases, .BTM files, and virtually all the other 4DOS features you already know.

Even if youve never used 4DOS, youll notice plenty of familiar items in Take Command.  Like 4DOS, Take Command is compatible with the default DOS command processor (COMMAND.COM), which youve probably used from the Windows MS-DOS Prompt icon, or at the DOS prompt outside of Windows.

There are also a few differences between running under 4DOS (or COMMAND.COM) and running under Take Command.  The primary differences are related to different methods for starting DOS programs;  this topic is covered in detail under Take Command and DOS Applications.  You should read the information there before changing Take Commands default options for starting DOS programs.

In order to support the Take Command screen scrollback buffer, some Take Command keystrokes are different from what you may be used to in 4DOS.  See Scrolling and History Keystrokes for more details.

Some command-line editing defaults have also been changed to conform more closely to Windows conventions.  In Take Command the default editing mode is insert, not overstrike, and the default insert-mode cursor is a line, not a block.  You can change these defaults with statements in TCMD.INI or via the Command Line page of the configuration dialogs, accessible from the Options menu.

Before using your 4DOS batch files and aliases under Take Command, see Using 4DOS Batch Files and Aliases.

What's new in Take Command are Windows-related features, including:

*	A built-in scrollback buffer  that lets you look back through the output from past commands.

*	A standard Windows menu bar for access to many commonly-used Take Command features.

*	A status bar showing memory and resource usage.

*	A customizable tool bar that gives you quick access to commands and applications.

*	Windows dialogs, accessible from the Options and Utilities menus, for editing environment variables, aliases, file descriptions, and startup parameters (the TCMD.INI file).

*	Direct access to Program Manager groups through the Applications menu.

*	High-speed, dialog-based file and text search (see "Find Files/Text" on the Utilities menu).  The new FFIND command gives you the same capabilities at the Take Command prompt.

*	Commands like ACTIVATE, MSGBOX, and QUERYBOX that allow you to use Windows features and control Windows applications from your batch files.

*	A new technology, called "Caveman," which you can use to run many DOS utilities in the Take Command window (see Take Command and DOS Applications for details).


Scrolling and History Keystrokes

In order to support the scrollback buffer, some Take Command keystrokes are different from what you may be used to in 4DOS.  The differences are:

4DOS	Take Command

Command Line:

Previous command	Up [↑]	Ctrl-Up

Next command	Down [↓]	Ctrl-Down

History window	PgUp	Ctrl-PgUp

Directory history	Ctrl-PgUp	F6

Screen Scrollback:

Up one line	N/A	Up [↑]

Down one line	N/A	Down [↓]

Up one page	N/A	PgUp

Down one page	N/A	PgDn

If you prefer to reverse this arrangement and use the arrow and PgUp keys to access the command history without having to press Ctrl (as in 4DOS), see the SwapScrollKeys directive in TCMD.INI, or the corresponding option on the Command Line page of the configuration dialogs.  SwapScrollKeys switches the keystroke mapping so that the ↑, ↓, and PgUp keys manipulate the command history, and Ctrl-↑, Ctrl-↓, Ctrl-PgUp, and Ctrl-PgDn are used to control the scrollback buffer.  (SwapScrollKeys does not affect the use of F6 for the directory history).

You can also change the way any individual key operates with the corresponding key mapping directive in TCMD.INI.  The directives associated with the history and scrolling keys are:

NextHistory, PrevHistory

HistWinOpen, DirWinOpen

ScrollUp, ScrollDown, ScrollPgUp, ScrollPgDn


Using 4DOS Batch Files and Aliases

Take Command and 4DOS aliases are separate and independent; Take Command does not automatically "inherit" aliases from a previously loaded copy of 4DOS, and it cannot pass aliases on to a copy of 4DOS started from the Take Command prompt.  However, you can load aliases from your Take Command startup batch file.  These can be the same aliases you use in 4DOS, or a set that is just for Take Command.

While many of your 4DOS aliases will work well under Take Command, you'll probably want to create a separate set of Take Command aliases.  This will allow you to account for the differences in running DOS applications (see Take Command and DOS Applications), and to create new aliases that take advantage of Take Command features that are unavailable in 4DOS.

If you want to write aliases or batch files that are used in both Take Command and 4DOS, but that behave differently in each environment, use the %_DOS variable to make the distinction.  For example, this batch file fragment uses the INPUT command to accept a string if it is run under 4DOS, but uses the Windows-style QUERYBOX if it is run under Take Command:

iff "%_dos" == "WIN" then

querybox "Enter your name:  " %%name

else

input "Enter your name:  " %%name

endiff

Aliases and batch files which simply manipulate files or use other internal commands should work with little or no change under Take Command.  However, as a general rule, you should test any batch file developed for 4DOS or COMMAND.COM before assuming it will do exactly what you want under Take Command.  Pay particular attention to batch files which run complex sequences of external programs.

If you use aliases or batch files to perform a sequence which mixes internal commands and DOS applications, the sequence may not work the way you expect under Take Command.  For example, suppose you have an alias that changes the screen color, starts a DOS application, and then resets the color again.  If the DOS application is started in a separate window the color changes will not affect it -- a contingency you probably didnt have to consider when you wrote the batch file.

Similarly, if you run a sequence of several DOS applications which depend on each others results (for example, through the use of error levels), they may not run the same way under Take Command that they do under 4DOS or COMMAND.COM.  For example, if one DOS application runs in its own window and another runs under Caveman, error levels will not be passed between the applications and your batch file or alias wont run the way you expect.

You may also find that you want to take advantage of some of the new features of Take Command to improve your batch files.  For example, the START command offers additional flexibility in starting applications.  MSGBOX and QUERYBOX can be used to create Windows-style input prompts, and KEYSTACK and ACTIVATE will help control your Windows applications.

Once you get used to these enhancements and minor differences youll find that you can use Take Command to manage your system using the same techniques and features you are already familiar with from your experience with 4DOS or COMMAND.COM.


Batch Files

A batch file is a file that contains a list of commands to execute.  Take Command reads and interprets each line as if it had been typed at the keyboard.  Like aliases, batch files are handy for automating computing tasks.  Unlike aliases, batch files can be as long as you wish.  Batch files take up separate disk space for each file, and can't usually execute quite as quickly as aliases, since they must be read from the disk.

The topics included in this section are:

.BAT and .BTM Files

Echoing in Batch Files

Batch File Line Continuation

Batch File Parameters

Automatic Batch Files

Batch File Compression

Argument Quoting

4DOS, 4OS2, 4DOS/NT and Take Command Compatibility

REXX Support


.BAT and .BTM Files

A batch file can run in two different modes.  In the first, traditional mode, each line of the batch file is read and executed individually, and the file is opened and closed to read each line.  In the second mode the batch file is opened once, the entire file is read into memory, and the file is closed.  The second mode can be 5 to 10 times faster, especially if most of the commands in the batch file are internal commands.  However, only the first mode can be used for self-modifying batch files (which are rare), and for batch files larger than 64K bytes.

The batch file's extension determines its mode.  Files with a .BAT extension are run in the slower, traditional mode.  Files with a .BTM extension are run in the faster, more efficient mode.  You can change the execution mode inside a batch file with the LOADBTM command.


Echoing in Batch Files

By default, each line in a batch file is displayed or "echoed" as it is executed.  You can change this behavior, if you want, in several different ways:

Any batch file line that begins with an [@] symbol will not be displayed.

The display can be turned off and on within a batch file with the ECHO OFF and ECHO ON commands.

The default setting can be changed with the SETDOS /V command or the BatchEcho directive in the .INI file.

For example, the following line turns off echoing inside a batch file.  The [@] symbol keeps the batch file from displaying the ECHO OFF command:

@echo off

Take Command also has a command line echo that is unrelated to the batch file echo setting.  See ECHO for details about both settings.


Batch File Line Continuation

Take Command will combine multiple lines in the batch file into a single line for processing when you include the escape character as the very last character of each line to be combined (except the last).  The default escape character is Ctrl-X, which appears in the Take Command window as an up-arrow [↑].  For example:

        c:\> echo The quick brown fox jumped over the lazy↑

        sleeping↑

        dog. > alphabet

You cannot use this technique to extend a batch file line beyond the normal line length limit of 255 characters.


Batch File Parameters

Like aliases and application programs, batch files can examine the command line that is used to invoke them.  The command tail (everything on the command line after the batch file name) is separated into individual parameters (also called arguments or batch variables) by scanning for the spaces, tabs, and commas that separate the parameters.  A batch file can work with the individual parameters or with the command tail as a whole.

These parameters are numbered from %1 to %127.  %1 refers to the first parameter on the command line, %2 to the second, and so on.  It is up to the batch file to determine the meaning of each parameter.  You can use quotation marks to pass spaces, tabs, commas, and other special characters in a batch file parameter; see Argument Quoting for details.

Parameters that are referred to in a batch file, but which are missing on the command line, appear as empty strings inside the batch file.  For example, if you start a batch file and put two parameters on the command line, any reference in the batch file to %3, or any higher-numbered parameter, will be interpreted as an empty string.

A batch file can also work with three special parameters:  %0 contains the name of the batch file as it was entered on the command line, %# contains the number of command line arguments, and %n& contains the complete command-line tail starting with argument number "n" (for example, %3& means the third parameter and all those after it).  The default value of "n" is 1, so %& contains the entire command tail.  The values of these special parameters will change if you use the SHIFT command.

For example, if your batch file interprets the first argument as a subdirectory name then the following line would move to the specified directory:

cd %1

Batch files can also use environment variables, internal variables, and variable functions.


Automatic Batch Files
TCSTART and TCEXIT

Each time Take Command starts, it looks for an automatic batch file called TCSTART.BTM or TCSTART.BAT.  If the TCSTART batch file is not in the same directory as Take Command itself, you should use the TCSTARTPath directive in your .INI file to specify its location.  TCSTART is optional, so Take Command will not display an error message if it cannot find the file.

Whenever an Take Command session ends, it runs a second automatic batch file called TCEXIT.BTM or TCEXIT.BAT.  This file, if you use it, should be in the same directory as your TCSTART batch file.  Like TCSTART, TCEXIT is optional.  It is not necessary in most circumstances, but it is a convenient place to put commands to save information such as a history list before Take Command ends, or LOG the end of the session.


Batch File Compression

You can compress your .BTM files with a program called BATCOMP.EXE, which is distributed with Take Command.  This program condenses batch files by about a third and makes them unreadable with the LIST command and similar utilities.  Compressed batch files run at approximately the same speed as regular .BTM files.

You may want to consider compressing batch files if you need to distribute them to others and keep your original code secret or prevent your users from altering them.  You may also want to consider compressing batch files to save some disk space on the systems where the compressed files are used.

The full syntax for the batch compression program is

BATCOMP [/O] input file [output file ]

You must specify the full name of the input file, including its extension, on the BATCOMP command line.  If you do not specify the output file, BATCOMP will use the same base name as the input file and add a .BTM extension.  BATCOMP will also add a .BTM extension if you specify a base name for the output file without an extension.  For example, to compress MYBATCH.BAT and save the result as MYBATCH.BTM, you can use any of these three commands:

[c:\] batcomp mybatch.bat

[c:\] batcomp mybatch.bat mybatch

[c:\] batcomp mybatch.bat mybatch.btm

If the output file (MYBATCH.BTM in the examples above) already exists, BATCOMP will prompt you before overwriting the file.  You can disable the prompt by including /O on the BATCOMP command line immediately before the input file name.  Even if you use the /O option, BATCOMP will not compress a file into itself.

JP Software does not provide a decompression utility to uncompress batch files.  If you use BATCOMP.EXE, make sure that you also keep a copy of the original batch file for future inspection or modification.

Each of our command processors includes its own version of BATCOMP.EXE, set up to run under the corresponding operating system. However, the output produced by each program is the same, so a batch file compressed with any version of BATCOMP can be used with any JP Software command processor.

If you plan to distribute batch files to users of different platforms, see 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility.


Argument Quoting

As it parses the command line, Take Command looks for the caret [^] command separator, conditional commands (|| or &&), white space (spaces, tabs, and commas), percent signs [%] which indicate variables or batch file arguments to be expanded, and redirection and piping characters (>, <, or |).

Normally, these special characters cannot be passed to a command as part of an argument.  However, you can include any of the special characters in an argument by enclosing the entire argument in single back quotes [`] or double quotes ["].  Although both back quotes and double quotes will let you build arguments that include special characters, they do not work the same way.

No alias or variable expansion is performed on an argument enclosed in back quotes.  Redirection symbols inside the back quotes are ignored.  The back quotes are removed from the command line before the command is executed.

No alias expansion is performed on expressions enclosed in double quotes.  Redirection symbols inside double quotes are ignored.  However, variable expansion is performed on expressions inside double quotes.  The double quotes themselves will be passed to the command as part of the argument.

For example, suppose you have a batch file CHKNAME.BTM which expects a name as its first parameter (%1).  Normally the name is a single word.  If you need to pass a two-word name with a space in it to this batch file you could use the command:

c:\> chkname `MY NAME`

Inside the batch file, %1 will have the value MY NAME, including the space.  The back quotes caused Take Command to pass the string to the batch file as a single argument.  The quotes keep characters together and reduce the number of arguments in the line.

When an alias is defined in a batch file or from the command line, its argument can be enclosed in back quotes to prevent the expansion of replaceable parameters, variables, and multiple commands until the alias is invoked.  See ALIAS for details.

You can disable and re-enable back quotes and double quotes with the SETDOS /X command.


4DOS, 4OS2, and 4DOS/NT Compatibility
4DOS, 4OS2, 4DOS/NT and Take Command Compatibility

If you use two or more of our products, or if you want to share aliases and batch files with users of different products, you need to be aware of the differences in three important characters:  the Command Separator (see Multiple Commands), the Escape Character (see Escape Character), and the Parameter Character (see Batch File Parameters).

The default values of each of these characters in each product is shown in the following chart.  (In this section, an up-arrow [↑] is used for the ASCII Ctrl-X character, numeric value 24.  The appearance of control characters depends on the font you use.  In many fonts the up-arrow character is displayed as a "block" or other non-descript character, but the Terminal font used by default in Take Command typically does display the Ctrl-X character as an up-arrow.):

Separator	Escape	Parameter

4DOS & TCMD16	^	↑	&

4OS2, 4DOS/NT & TCMD32	&	^	$

In your batch files and aliases, and even at the command line, you can smooth over these differences in two ways:

1) Select a consistent set of characters with .INI file configuration directives, the SETDOS command, or the Options 1 page of the configuration dialogs.  For example, to set the Take Command characters to match 4OS2, use these lines in TCMD.INI:

CommandSep = &

EscapeChar = ^

ParameterChar = $

2) Use internal variables that contain the current special character, rather than using the character itself (see + and =).  For example, this command:

if "%1" == "" (echo Argument missing! ^ quit)

will only work if the command separator is a caret. However, this version works regardless of the current command separator:

if "%1" == "" (echo Argument missing! %+ quit)

The following chart shows the correspondence between the appropriate SETDOS command options, .INI file directives, and internal variables:

Special	SETDOS	INI File	Internal

Character	Switch	Directive	Variable

Command Separator	/C	CommandSep	%+

Escape Character	/E	EscapeChar	%=

Parameter Character	/P	ParameterChar	(none)


REXX Support

REXX is a a powerful file and text processing language developed by IBM, and available on many PC and other platforms.  REXX is an ideal extension to the Take Command batch language, especially if you need advanced string processing capabilities.

The REXX language is not built into Take Command.  You can use Personal REXX for Windows, developed by Quercus Systems of Saratoga, CA.  (Personal REXX is available from JP Software or directly from Quercus Systems.)

REXX programs are stored in .REX files.  When Take Command loads, it looks for the Personal REXX .DLLs.  If found, Take Command checks to see if you are running a .REX file.  If so, it passes the file to Personal REXX for processing.


Take Command Menus

Like all Windows applications, Take Command displays a menu bar along the top of the Take Command window.  To select a particular menu item, click once on the menu heading, or use Alt+x where "x" is the underlined letter on the menu bar (for example, Alt+F displays the File menu).

The items on the menu bar allow you to select a variety of Take Command features:

File Menu

Edit Menu

Apps Menu

Options Menu

Utilities Menu

Help Menu


File Menu

The File menu allows you to save or print the screen buffer, or exit Take Command.

Save to File...

Saves the contents of the screen buffer to a file.  A Save As dialog box appears in which you can enter the name of the file that you wish to use.

Print...

Sends the contents of the screen buffer to the printer.  A Print dialog box appears in which you can choose the portion of the screen buffer you wish to print.

Setup Printer...

Displays a standard printer setup dialog box.  The options available in the dialog box depend on the printer driver(s) you are using.

Refresh

Redraws everything on the Take Command screen.

Exit Windows

Shuts down Windows and returns to the DOS prompt.

Restart Windows

Exits Windows and then automatically restarts it.  This option may be useful for checking the effects of changes (for example, changes to Windows' WIN.INI or SYSTEM.INI files).

Exit

Ends the current Take Command session.  If Take Command is running as the Windows shell, this option performs the same action as Exit Windows.


Edit Menu

The Edit menu allows you to copy text between the Take Command window and the Windows clipboard.

To use the the Copy command you must first select a block of text with the mouse or with the Select All command, below.  If you hold down the mouse button 2 while you select a block of text, that block will be copied to the clipboard automatically when you release the button.

The commands on this menu can also be invoked with keystrokes.  Some Windows applications support the use of Ctrl-C for Copy, Ctrl-X for Cut, and Ctrl-V for Paste.  Take Command uses a different set of keystrokes (Ctrl-Ins, Shift-Del, and Shift-Ins) to avoid conflicts with the use of Ctrl-C under DOS, and Ctrl-X under 4DOS.

For more information on copying text see Highlighting and Copying Text.

Copy

Copies selected text from the Take Command screen buffer to the Windows clipboard.

Paste

Copies text from the Windows clipboard to the command line.

Copy + Paste

Copies the selected text directly to the command line.

Select All

Marks the entire contents of the Take Command screen buffer as selected text.


Apps Menu

Run

Displays the run dialog box from which you can run an application or batch file.  Take Command remembers the commands you have run from this dialog in the current session.  To select from this list click on the drop-down arrow to the right of the "Command Line" field, or press the down-arrow.

DOS Box

Starts a DOS session by running the default command processor.  The DOS session is started using the Windows _DEFAULT.PIF file.  To start a DOS session with your own PIF settings enter the name of the corresponding .PIF file at the Take Command prompt.

Task List

Displays a list of all tasks currently running.  When the list is displayed, you can choose to switch to a different task, display information about a task, or close a task.  You can also close a specific window; doing so may also close the associated task (depending on how the program whose window you are closing was written).

End DOS app in Caveman

Terminates the DOS program currently running under Caveman, and destroys the Caveman virtual machine (the virtual machine will be restarted when necessary to run another DOS program).  Use this option if a DOS program is "hung" and does not respond to Ctrl-C or Ctrl-Break.

Take Command Group Lists

At the end of the Run Menu, you will see the names of the groups defined in your Windows shell (Program Manager or a similar program).  If you select a group name, a sub-menu will appear with the items in the group.  When you click on an item in the sub-menu, it will be launched for you.  If the item is set to run minimized, Take Command will start it minimized.

Take Command collects the group names and the list of applications in each group by communicating with the Program Manager (or another Windows shell which responds to Take Command's request for group information), or by reading the Program Manager's .GRP files.

For more information or to change the way group names are collected see Take Command and Windows Shells.


Options Menu

Configure Take Command

Opens a series of dialogs which you can use to change the configuration of Take Command.

Any changes you make will take effect immediately.  If you return to Take Command by selecting the OK button, new settings will only stay in effect until you end the current Take Command session.  If you return to Take Command by selecting Save, the changes will be recorded in the [TakeCommand] section of TCMD.INI and will be in effect each time you start Take Command.

Configure Tool Bar

Opens a dialog in which you can define up to 16 buttons for the Take Command tool bar.

Select Font

Opens a dialog box from which you can select the font and type size for the Take Command window.  You can choose from any monospaced font that has been properly installed in Windows.

Caution:  Some fonts will not display all of the characters used by Take Command.  In particular the DRAWBOX, DRAWHLINE, and DRAWVLINE commands use line-drawing characters which are not included in most Windows fonts.  To ensure that these commands work properly, use the "Terminal" font, which typically does include line-drawing characters.

Logging

Controls logging via a submenu with two choices:

Command:  Enables or disables command logging using the default TCMDLOG file or the file you have chosen with the LOG command or the LogName directive in the TCMD.INI file.

History:  Enables or disables command history logging using the default TCMDHLOG file or the file you have specified with the LOG /H command or the HistLogName directive in the TCMD.INI file.

Show Tool Bar

Select this item to enable or disable the Take Command tool bar, which appears near the top of the Take Command window.  The tool bar will not appear until you have defined at least one item for it with the Configure Tool Bar command, above.

Show Status Bar

Select this item to enable or disable the Take Command status bar, which appears near the bottom of the Take Command window.

VM Setup

Set the parameters for the Caveman "Virtual Machine" used to run DOS applications from Take Command.  This option is only available if Caveman is enabled.  For additional details on Caveman see the Take Command and DOS Applications and Caveman topics.


Utilities Menu

Find Files/Text

Opens the find files dialog box which lets you search for files or text interactively (see FFIND to search from the command line).

Once Take Command has created a list of files based on your specifications, you can double-click on a file name and Take Command will display an information box about the file. From the information box, you can choose to list, edit, or run the file.

Descriptions

Opens an edit window in which you can view and change the descriptions of files in any directory available on your system.  See DESCRIBE for details on file descriptions.

Aliases

Opens an edit window in which you can view and change the list of current aliases.  You can also use this window to import aliases from a file or save all current aliases in a file. Any changes you make will take effect as soon as you return to Take Command.

Environment

Opens an edit window in which you can view and change the current environment.  Any changes you make will be immediately recorded in Take Command's environment.

Editor

Starts the Windows Notepad editor or any other editor you have specified with the Editor directive in TCMD.INI

Recorder

Starts the Windows Recorder to create keystroke macros.


Help Menu

Contents

Displays the Table of Contents for Take Command Help.

How to Use Help

Displays the standard text that explains the Windows help system.

Search Topics

Displays the Search dialog for Take Command Help.  This is the same dialog you will see if you click on the Search button from within the help system..

About

Displays Take Command version, copyright, and license information.


Tool Bar
The Take Command Tool Bar

The Take Command screen has an optional Tool Bar that you can use to execute internal or external commands, aliases, or batch files with the click of a mouse.

To create buttons for the Tool Bar, select Configure Tool Bar from the Options menu.  This selection displays the tool bar dialog.

You can define up to 16 Tool Bar buttons.

To enable or disable the Tool Bar, use the ToolBarOn directive in TCMD.INI, the Tool Bar Enable setting on the Display page in the configuration dialogs, or the Show Tool Bar command in the Options menu.

The configuration dialog and TCMD.INI settings are modified when you enable and disable the tool bar from the Options menu.  This preserves the tool bar state when you close Take Command, and restores it the next time you start a Take Command session.


Status Bar
The Take Command Status Bar

The Take Command screen has an optional Status Bar that shows information about your system.  To enable or disable the Status Bar, use the StatusBarOn directive in TCMD.INI, the Status Bar Enable setting on the Display page in the configuration dialogs,  or the Show Statusbar command in the Options menu.

The configuration dialog and TCMD.INI settings are modified when you enable and disable the status bar from the Options menu.  This preserves the tool bar state when you close Take Command, and restores it the next time you start a Take Command session.

The Status Bar shows 7 pieces of information:

The Date, based on the Windows clock.

The Time, based on the Windows clock.

The Windows mode (Enh for 386 enhanced mode, or Std for standard mode) and the amount of free virtual memory, in kilobytes.  (The amount of memory shown includes virtual memory that Windows creates on disk.)

The percentage of free GDI (Graphics Device Interface) resources.  When this number drops below 25% the value will turn red.  When resources are this low Windows may begin to slow down, and you may want to shut down some applications.

The percentage of free User resources.    When this number drops below 25% the value will turn red.  When resources are this low Windows may begin to slow down, and you may want to shut down some applications.

The state of the Caps Lock key on the keyboard.

The state of the Num Lock key on the keyboard.


Using the Scrollback Buffer

Take Command retains the text displayed on its screen in a "scrollback buffer".

You can scroll through this buffer using the mouse and the vertical scroll bar at the right side of the Take Command window, just as you can in any Windows application.

You can also use the Up Arrow [↑] and Down Arrow [↓] keys to scroll the display one line at a time from the keyboard, and the PgUp and PgDn keys to scroll one page at a time.

If you enter text on the command line, Take Command will automatically return to the bottom of the buffer to display the text.

If you prefer to use the arrow and PgUp keys to access the command history (as in 4DOS), see the SwapScrollKeys directive in TCMD.INI, or the corresponding option on the Command Line page of the configuration dialogs.  SwapScrollKeys switches the keystroke mapping so that the ↑, ↓, and PgUp keys manipulate the command history, and Ctrl-↑, Ctrl-↓, Ctrl-PgUp, and Ctrl-PgDn are used to control the scrollback buffer.  For more details see Scrolling and History Keystrokes.

You can set the size of the scrollback buffer on the Display page of the configuration dialogs (available from the Options menu), or with the ScreenBufSize directive in TCMD.INI.

To clear the entire scrollback buffer, use the CLS /C command.


Highlighting and Copying Text

While you are working at the Take Command prompt you can use common Windows keystrokes to edit commands, and use the Windows clipboard to copy text between Take Command and other applications.

To copy text from the Take Command window to the clipboard, first use the mouse to highlight the text,  then press Ctrl-Ins, or use the Copy command on the Edit menu.  You can also mark the text using mouse button 2; in this case the text will be copied to the clipboard immediately when you release the mouse button.

To highlight text on the command line use the Shift key in conjunction with the Left, Right, Ctrl-Left, Ctrl-Right, Home, and End cursor movement keys.  The Del key will delete any highlighted text on the command line, or you can type new text to replace the highlighted text.

While the Take Command window contains text, it is not a document window like those used by word processors and other similar software, and you cannot move the cursor throughout the window as you can in text processing programs.  As a result, you cannot use the Windows shortcut keys like Shift-Left or Shift-Right to highlight text in the window.  These keys work only at the command line; to highlight text elsewhere in the window you must use the mouse.  You can also select all of the text in the Take Command screen buffer by using the Select All command on the Edit menu.

To copy text from the clipboard to the command line use Shift-Ins, or the Copy command on the Edit menu.

To paste text from elsewhere in the Take Command window directly onto the command line, highlight the text with the mouse and press Ctrl-Shift-Ins, or use the Copy+Paste command on the Edit menu.  This is equivalent to highlighting the text and pressing Ctrl-Ins followed by Shift-Ins.  It's a convenient way to copy a filename from a previous DIR or other command directly to the command line.

Some Windows applications support the use of Ctrl-C for Copy, Ctrl-X for Cut, and Ctrl-V for Paste.  Take Command uses a different set of keystrokes to avoid conflicts with the use of Ctrl-C under DOS, and Ctrl-X under 4DOS.

You should use caution when pasting text containing carriage return or line feed characters onto the command line.  If the text you insert contains one of these characters the command line will be executed just as if you had pressed Enter.  If you insert multiple lines, the text will be treated just like multiple lines of commands typed at the prompt.

You can also use Windows' Drag and Drop facility to paste a filename from another application onto the command line.


Cursor Display on LCD Screens

If you use a laptop or LCD screen and find the "I-Beam" cursor in the Take Command window difficult to see, use an IBeamCursor = No directive in the [TakeCommand] section of TCMD.INI to force the use of an arrow cursor in all parts of the window.


The Environment

The environment is a collection of information about your computer that every program receives.  Each entry in the environment consists of a variable name, followed by an equal sign and a string of text.  You can automatically substitute the text for the variable name in any command.  To create the substitution, include a percent sign [%] and a variable name on the command line or in an alias or batch file.

The following environment variables have special meanings in Take Command:

CDPATH

CMDLINE

COLORDIR

PATH

PROMPT

Take Command also supports two special types of variables.  Internal variables are similar to environment variables, but are stored internally within Take Command, and are not visible in the environment.  They provide information about your system for use in batch files and aliases.  Variable functions are referenced like environment variables, but perform additional functions like file handling, string manipulation and arithmetic calculations.

The SET command is used to create environment variables. For example, you can create a variable named BACKUP like this:

c:\> set BACKUP=*.bak;*.bk!;*.bk

If you then type

c:\> del %BACKUP

it is equivalent to the following command:

del *.bak;*.bk!;*.bk

The variable names you use this way may contain any alphabetic or numeric characters, the underscore character [_], and the dollar sign [$].  You can force acceptance of other characters by including the full variable name in square brackets, like this: %[AB##2].  You can also "nest" environment variables using square brackets.  For example %[%var1] means "the contents of the variable whose name is stored in VAR1".  A variable referenced with this technique cannot contain more than 255 characters of information.  Nested variable expansion can be disabled with the SETDOS /X command.

In Take Command the size of the environment is set automatically, and increased as needed when you add variables.

The trailing percent sign that was traditionally required for environment variable names is not usually required in Take Command, which accepts any character that cannot be part of a variable name as the terminator.  However, the trailing percent can be used to maintain compatibility.

The trailing percent sign is needed if you want to join two variable values.  The following examples show the possible interactions between variables and literal strings.  First, create two environment variables called ONE and TWO this way:

c:\> set ONE=abcd

c:\> set TWO=efgh

Now the following combinations produce the output text shown:

%ONE%TWO	abcdTWO   ("%ONE%" + "TWO")

%ONE%TWO%	abcdTWO   ("%ONE%" + "TWO%")

%ONE%%TWO	abcdefgh  ("%ONE%" + "%TWO")

%ONE%%TWO%	abcdefgh  ("%ONE%" + "%TWO%")

%ONE%[TWO]	abcd[TWO] ("%ONE%" + "[TWO]")

%ONE%[TWO]%	abcd[TWO] ("%ONE%" + "[TWO]%")

%[ONE]%TWO	abcdefgh  ("%[ONE]" + "%TWO")

%[ONE]%TWO%	abcdefgh  ("%[ONE]" + "%TWO%")

If you want to pass a percent sign to a command, or a string which includes a percent sign, you must use two percent signs in a row. Otherwise, the single percent sign will be seen as the beginning of a variable name and will not be passed on to the command.  For example, to display the string "We're with you 100%" you would use the command:

echo We're with you 100%%

You can also use back quotes around the text, rather than a double percent sign.  See Argument Quoting for details.


CDPATH

CDPATH tells Take Command where to search for directories specified by the CD, CDD, and PUSHD commands and in automatic directory changes.  (_CDPATH can be used as an alternative to CDPATH if you are using Microsoft Bookshelf, which uses a CDPATH variable for its own purposes.)

CDPATH is composed of a list of directories, separated by semicolons [;].  If CD, CDD, PUSHD, or an automatic directory change can't locate the specified directory to change to, they will append the specified directory name to each directory in CDPATH and attempt to change to that drive and directory, until the first match or the end of the CDPATH argument.  This allows you to use CDPATH as a quick way to find commonly used subdirectories which have unique names.  For example, if you are currently in the directory C:\WP\LETTERS\JANUARY and you'd like to change to D:\SOFTWARE\UTIL, you could enter the command:

c:\wp\letters\january> cdd d:\software\util

However, if the D:\SOFTWARE directory is listed in your CDPATH variable, and is the first directory in the list with a UTIL subdirectory, you can simply enter the command

c:\wp\letters\january> cdd util

to change to D:\SOFTWARE\UTIL.

You can create CDPATH with the SET command.  For example, if you want the directory change commands to search the C:\DATA directory, the D:\SOFTWARE directory, and the root directory of drive E:\ for the subdirectories that you name, you should create CDPATH with this command:

c:\> set cdpath=c:\data;d:\software;e:\


CMDLINE

CMDLINE is the fully expanded text of the currently executing command line.  CMDLINE is set just before invoking any .COM, .EXE, .BTM, or .BAT file.  If a command line is prefaced with an "@" to prevent echoing, it will not be put in CMDLINE, and any previous CMDLINE variable will be removed from the environment.


COLORDIR

COLORDIR controls directory display colors used by DIR and SELECT.  See Color-Coded Directories for a complete description of the format of this variable.


PATH (variable)
PATH

PATH is a list of directories that Take Command will search for executable files that aren't in the current directory.  PATH may also be used by some application programs to find their own files. See the PATH command for a full description of this variable.


PROMPT  (variable)
PROMPT

PROMPT defines the command-line prompt.  It can be set or changed with the PROMPT command.


Internal Variables

Internal variables are special variables built into Take Command to provide information about your system.  They are not actually stored in the environment, but can be used in commands, aliases, and batch files just like any environment variable. The values of these variables are stored internally in Take Command, and cannot be changed with the SET, UNSET, or ESET command.  However, you can override any of these variables by defining a new variable with the same name.

The list below gives a one-line description of each variable, and a cross-reference which selects a short help topic on that variable. Most of the variables are simple enough that the one-line description is sufficient.  However, for those variables marked with an asterisk [*], the cross-reference topic contains some additional information you may wish to review.  You can also obtain help on any variable with a HELP variable name command at the prompt (this is why each variable has its own topic, in addition to its appearance in the list below).

See the discussion after the variable list for some additional information, and examples of how these variables can be used.

The variables are:

Hardware status

_CPU	CPU type (386, 486, 586)

_KBHIT	Returns 1 if a keyboard input character is waiting

_MONITOR	Returns the monitor type (mono or color)

_NDP	Coprocessor type (0, 387)

_VIDEO	Returns the video adapter type (i.e., CGA, EGA, or VGA)

Operating system and software status

_ANSI	ANSI status (always 0 in Take Command)

_BOOT	Boot drive letter, without a colon

_CODEPAGE	Current code page number

_COUNTRY	Current country code

_DOS	* Operating system (WIN)

_DOSVER	* Operating system version (3.1, etc.)

_DPMI	DPMI version level.

_GDIFREE	Returns the percentage of free GDI resources

_KBHIT	Status of keyboard buffer

_MOUSE	Mouse driver flag (always 1 in Take Command)

_SYSFREE	Returns the percentage of free System resources

_USERFREE	Returns the percentage of free User resources

_WINDIR	Windows directory pathname

_WINSYSDIR	Windows system directory pathname

_WINTITLE	Current window title

_WINVER	Windows version number

Command processor status

_4VER	Take Command version (1.0, 1.01, etc.)

_BATCH	Batch nesting level

_BATCHLINE	Line number in current batch file.

_BATCHNAME	Full pathname of current batch file.

_DNAME	Name of the description file.

_HLOGFILE	Current history log file name

_LOGFILE	Current log file name

_SHELL	Shell level (0, 1, 2, ...)

_TRANSIENT	* Transient shell flag (0 or 1)

Screen, color, and cursor

_BG	Background color at cursor position

_CI	Current text cursor shape in insert mode

_CO	Current text cursor shape in overstrike mode

_COLUMN	Current cursor column

_COLUMNS	Screen width

_FG	Foreground color at cursor position

_ROW	Current cursor row

_ROWS	Screen height

Drives and directories

_CWD	Current drive and directory (d:\path)

_CWDS	Current drive and directory with trailing \ (d:\path\)

_CWP	Current directory (\path)

_CWPS	Current directory with trailing \ (\path\)

_DISK	Current drive (C, D, etc.)

_LASTDISK	Last possible drive (E, F, etc.)

Dates and times

_DATE	* Current date (mm-dd-yy)

_DAY	Day of the month (1 - 31)

_DOW	Day of the week (Mon, Tue, Wed, etc.)

_DOY	Day of the year (1 - 366)

_HOUR	Hour (0 - 23)

_MINUTE	Minute (0 - 59)

_MONTH	Month of the year (1 - 12)

_SECOND	Second (0 - 59)

_TIME	* Current time (hh:mm:ss)

_YEAR	Year (1980 - 2099)

Error codes

?	* Exit code, last external program

_?	* Exit code, last internal command

_SYSERR	* Last Windows error code

Compatibility

=	* Substitutes escape character

+	* Substitutes command separator

Examples

You can use these variables in a wide variety of ways depending on your needs.  Here are just a couple of examples.

Store the current date and time in a file, then save the output of a DIR command in the same file:

echo Directory as of %_date %_time > dirsave

dir >> dirsave

Use the IFF command to check whether there are enough resources free before running an application:

iff %_GDIFREE lt 40 then

   echo Not enough GDI resources!

   quit

else

   d:\mydir\myapp

endiff

Call another batch file if today is Monday:

if "%_DOW" == "Mon" call c:\cleanup\weekly.bat


?
? contains the exit code of the last external command.  Many programs return a "0" to indicate success and a non-zero value to signal an error.  However, not all programs return an exit code.  If no explicit exit code is returned, the value of %? is undefined.


_?
_? contains the exit code of the last internal command.  It is set to "0" if the command was successful, "1" if a usage error occurred, "2" if another command processor error or an operating system error occurred, or "3" if the command was interrupted by Ctrl-C or Ctrl-Break.  You must use or save this value immediately, because it is set by every internal command.


=
= returns the current escape character.  Use this variable, instead of the actual escape character, if you want your batch files and aliases to work regardless of how the escape character is defined.  For example, if the escape character is a caret [^] (the default in Take Command) both of the commands below will send a form feed to the printer.  However, if the escape character has been changed,  the first command will send the string "^f" to the printer, while the second command will continue to work as intended.

echos ^f > prn

echos %=f > prn


+
+ returns the current command separator.  Use this variable, instead of the actual command separator, if you want your batch files and aliases to work regardless of how the command separator is defined.  For example, if the command separator is an ampersand [^] (the default in Take Command) both of the commands below will display "Hello" on one line and "world" on the next. However, if the command separator has been changed the first command will display "Hello ^ echo world", while the second command will continue to work as intended.

echo Hello ^ echo world

echo Hello %+ echo world


_4VER
_4VER is the current Take Command version (for example, "1.0")


_ANSI
_ANSI is always "0" in Take Command.  (Windows doesn't support ANSI sequences except in DOS sessions.)


_BATCH
_BATCH is the current batch nesting level.  It is "0" if no batch file is currently being processed.


_BATCHLINE
_BATCHLINE is the current line number in the current batch file.  It is "-1" if no batch file is currently being processed.


_BATCHNAME
_BATCHNAME is the full pathname of the current batch file.  It is an empty string is no batch file is currently being processed.


_BG
_BG is a string containing the first three characters of the screen background color at the current cursor location (for example, "Bla").


_BOOT
_BOOT is the boot drive letter, without a colon.


_CI
_CI is the current text cursor shape in insert mode, as a percentage.


_CO
_CO is the current text cursor shape in overstrike mode, as a percentage.


_CODEPAGE
_CODEPAGE is the current code page number.


_COLUMN
_COLUMN is the current cursor column (for example, "0" for the left side of the screen).


_COLUMNS
_COLUMNS is the current number of screen columns (for example, "80").


_COUNTRY
_COUNTRY is the current country code.


_CPU
_CPU is the CPU type:

386	i386

486	i486

586	Pentium


_CWD
_CWD is the current working directory in the format d:\pathname.


_CWDS
_CWDS has the same value as CWD, except it ends the pathname with a backslash [\].


_CWP
_CWP is the current working directory in the format \pathname.


_CWPS
_CWPS has the same value as CWP, except it ends the pathname with a backslash [\].


_DATE
_DATE contains the current system date, in the format mm-dd-yy (U.S.), dd-mm-yy (Europe), or yy-mm-dd (Japan).


_DAY
_DAY is the day of the month (1 to 31).


_DISK
_DISK is the current disk drive, without a colon (for example, "C").


_DNAME
_DNAME is the name of the description file.  By default, the description file is called DESCRIPT.ION.  The name can be changed with the DescriptionName directive in 4NT.INI, or the SETDOS /D command.


_DOS
_DOS is the operating system type.  Take Command always returns "WIN" for Take Command running under Windows 3.1 or above, or "WIN32" for Take Command/32 running under Windows NT.  4DOS always returns "DOS", 4OS2 always returns "OS2", 4DOS/NT always returns "NT".  This may be useful if you have batch files running under more than one operating system or command processor.


_DOSVER
_DOSVER is the current operating system version (for example, "6.2").


_DOW
_DOW is the first three characters of the current day of the week ("Mon", "Tue", "Wed", etc.).


_DOY
_DOY is the day of the year (1 to 366).


_DPMI
_DPMI returns the DPMI version level, or 0 if DPMI isn't present.


_FG
_FG is a string containing the first three letters of the screen foreground color at the current cursor position (for example, "Whi").


_GDIFREE
_GDIFREE is the percentage of free GDI resources.  This information is also displayed on the Take Command status bar.


_HLOGFILE
 _HLOGFILE  returns the name of the current history log file (or an empty string if LOG /H is OFF).


_HOUR
_HOUR is the current hour (0 - 23).


_KBHIT
_KBHIT returns 1 if one or more keystrokes are waiting in the keyboard buffer, or 0 if the keyboard buffer is empty.


_LASTDISK
_LASTDISK is the last valid drive letter, without a colon.


_LOGFILE
_LOGFILE  returns the name of the current log file (or an empty string if LOG is OFF).


_MINUTE
_MINUTE is the current minute (0 - 59).


_MONITOR
_MONITOR is the monitor type (mono or color).


_MONTH
_MONTH is the month of the year (1 to 12).


_MOUSE
_MOUSE always returns "1" in Take Command.


_NDP
_NDP is the coprocessor type:

0	no coprocessor is installed

387	80387, 80486DX, or Pentium


_ROW
_ROW is the current cursor row (for example, "0" for the top of the screen).


_ROWS
_ROWS is the current number of screen rows (for example, "25").


_SECOND
_SECOND is the current second (0 - 59).


_SHELL
_SHELL is the current shell nesting level.  The primary shell is level "0", and each subsequent secondary shell increments the level by 1.


_SYSERR
_SYSERR is the error code of the last operating system error. You will need a technical or programmer's manual to understand these error values.


_SYSFREE
_SYSFREE is the percentage of free System resources.  This information is also displayed on the Take Command status bar.


_TIME
_TIME contains the current system time in the format hh:mm:ss. The separator character may vary depending upon your country information.


_TRANSIENT
_TRANSIENT is "1" if the current shell is transient (started with a /C, see Startup Options for details), or "0" otherwise.


_USERFREE
_USERFREE is the percentage of free User resources.  This information is also displayed on the Take Command status bar.


_VIDEO
_VIDEO is the current video adapter type (cga, ega, or vga).


_WINDIR
_WINDIR returns the pathname of the Windows directory.


_WINSYSDIR
_WINSYSDIR returns the pathname of the Windows system directory.


_WINTITLE
_WINTITLE returns the title of the current window.


_WINVER
_WINVER returns the current Windows version number.


_YEAR
_YEAR is the current year (1980 to 2099).


Variable Functions

Variable functions are like internal variables, but they take one or more arguments (which can be environment variables or even other variable functions) and they return a value.

The list below gives a one-line description of each function, and a cross-reference which selects a separate help topic on that function.  A few of the variables are simple enough that the one-line description is sufficient, but in most cases you should check for any additional information in the cross-referenced explanation if you are not already familiar with a function.  You can also obtain help on any function with a HELP @functionname command at the prompt.

See the discussion after the function list for additional information and examples.

The variable functions are:

System status

@DOSMEM[b|k|m]	Size of largest free memory block

@READSCR[row,col,len]	Read characters from the screen

Drives and devices

@CDROM[d:]	CD-ROM drive detection (0 or 1)

@DEVICE[name]	Character device detection

@DISKFREE[d:,b|k|m]	Free disk space

@DISKTOTAL[d:,b|k|m]	Total disk space

@DISKUSED[d:,b|k|m]	Used disk space

@LABEL[d:]	Volume label

@LPT[n]	Printer ready status (0 or 1)

@READY[d:]	Drive ready status (0 or 1)

@REMOTE[d:]	Remote (network) drive detection (0 or 1)

@REMOVABLE[d:]	Removable drive detection (0 or 1)

Files

@ATTRIB[filename,rhsda]	Test or return file attributes

@DESCRIPT[filename]	File description

@FILEAGE[filename]	File age (date and time)

@FILECLOSE[n]	Close a file

@FILEDATE[filename]	File date

@FILEOPEN[filename,mode[,type]]	Open a file

@FILEREAD[n[,length]]	Read next line from a file

@FILES[filename]	Count files matching a wildcard

@FILESEEK[n,offset,start]	Move a file pointer

@FILESEEKL[n,line]	Move a file pointer to a specified line

@FILESIZE[filename,b|k|m]	Size of files matching a wildcard

@FILETIME[filename]	File time

@FILEWRITE[n,text]	Write next line to a file

@FILEWRITEB[n,length,text]	Write data to a file

@FINDFIRST[filename,nrhsda]	Find first matching file

@FINDNEXT[filename,nrhsda]	Find next matching file

@LINE[filename,n]	Read a random line from a file

@LINES[filename]	Count lines in a file

@SEARCH[filename]	Path search

@UNIQUE[d:\path]	Create file with unique name

File names

@EXT[filename]	File extension

@FILENAME[filename]	File name and extension

@FULL[filename]	Full file name with path

@NAME[filename]	File name without path or extension

@PATH[filename]	File path without name

Strings and characters

@ASCII[c]	Numeric ASCII value for a character

@CHAR[n]	Character value for numeric ASCII

@COMMA[n]	Insert commas into a number

@FORMAT[[-][x][.y],string]	Reformat a string

@INDEX[string1,string2]	Position of one string in another

@INSTR[start,length,string]	Extract a substring

@LEN[string]	Length of a string

@LOWER[string]	Convert string to lower case

@REPEAT[c,n]	Repeat a character

@SUBSTR[string,start,length]	Extract a substring

@TRIM[string]	Remove blanks from a string

@UPPER[string]	Convert string to upper case

@WORD[["xxx",]n,string]	Extract a word from a string

@WORDS[["xxx"],string]	Count words in a string

Numbers and arithmetic

@DEC[%var]	Decremented value of a variable

@EVAL[expression]	Arithmetic calculations

@INC[%var]	Incremented value of a variable

@INT[n]	Integer part of a number

@NUMERIC[string]	Test if a string is numeric

@RANDOM[min,max]	Generate a random integer

Dates and times

@DATE[mm-dd-yy]	Convert date to number of days

@MAKEAGE[date[,time]]	Convert date to file timestamp format

@MAKEDATE[n]	Convert number of days to date

@MAKETIME[n]	Convert number of seconds to time

@TIME[hh:mm:ss]	Convert time to number of seconds

Input dialog boxes

@GETDIR[d:\path]	Prompt for a directory name.

@GETFILE[d:\path\filename[,filter]]	Prompt for a path and file name.

Utility

@ALIAS[name]	Value of an alias

@EXEC[command]	Execute a command

@IF[condition,true,false]	Evaluates an expression

@INIREAD[filename,section,entry]

Return an entry from an .INI file

@INIWRITE[filename,section,entry,string]

Write an entry in an .INI file

@SELECT[file,t,l,b,r,title]	Menu selection

@TIMER[n]	Get split time from timer.

Like all environment variables, these variable functions must be preceded by a percent sign (%@EVAL, %@LEN, etc.).  All variable functions must have square brackets enclosing their argument(s).  The argument(s) to a variable function cannot exceed 255 characters in length for all arguments taken as a group.

Some variable functions, like @DISKFREE, are shown with "b|k|m" as one of their arguments.  Those functions return a number of bytes, kilobytes, or megabytes based on the "b|k|m" argument:

b	return the number of bytes

K	return the number of kilobytes (bytes / 1,024)

k	return the number of thousands of bytes (bytes / 1,000)

M	return the number of megabytes (bytes / 1,048,576)

m	return the number of millions of bytes (bytes / 1,000,000)

You can include commas in the results from a "b|k|m" function by appending a "c" to the argument.  For example, to add commas to a "b" or number of bytes result, enter "bc" as the argument.

In variable functions which take a drive letter as an argument, like @DISKFREE or @READY, the drive letter must be followed by a colon.  The function will not work properly if you use the drive letter without the colon.

The @FILEREAD, @FILEWRITE, @FILESEEK, and @FILECLOSE functions allow you to access files based on a file handle.  These functions should only be used with file handles returned by @FILEOPEN!  If you use them with any other number you may damage other files opened by Take Command (or by the program which started Take Command), or hang your system.

Examples

You can use variable functions in a wide variety of ways depending on your needs.  We've included a few examples below to give you an idea of what's possible.

To set the prompt to show the amount of free memory (see PROMPT for details on including variable functions in your prompt):

c:\> prompt (%%@dosmem[K]K) $p$g

Set up a simple command-line calculator.  The calculator is used with a command like CALC 3 * (4 + 5):

c:\> alias calc `echo The answer is:  %@eval[%&]`


@ALIAS
@ALIAS[name]:  Returns the contents of the specified alias as a string, or a null string if the alias doesn't exist.  When manipulating strings returned by @ALIAS you may need to disable certain special characters with the SETDOS /X command. Otherwise, command separators, redirection characters, and other similar "punctuation" in the alias may be interpreted as part of the current command, rather than part of a simple text string.


@ASCII
@ASCII[c]:  Returns the numeric value of the specified ASCII character as a string.  For example %@ASCII[A] returns 65.  You can put an escape character [^] before the actual character to process.  This allows quotes and other special characters as the argument (e.g., %@ASCII[^`]).


@ATTRIB
@ATTRIB[filename[,nrhsda[,p]]]:  Returns a "1" if the specified file has the matching attribute(s); otherwise returns a "0".  The attributes are:

N	Normal (no attributes set)

R	Read-only

H	Hidden

S	System

D	Directory

A	Archive

The attributes (other than N) can be combined (for example %@ATTRIB[MYFILE,HS]).  Normally ATTRIB will only return a "1" if all of the attributes match.  However, if a final ,p is included (for partial match), then @ATTRIB will return a 1 if any of the attributes match.  For example, %@ATTRIB[MYFILE,HS,p] will return a 1 if MYFILE has the hidden, system, or both attributes.  Without ,p the function will return a 1 only if MYFILE has both attributes.

If you do not specify any attributes, @ATTRIB will return the attributes of the specified file in the format RHSAD, rather than a "0" or "1".  Attributes which are not set will be replaced with an underscore.  For example. if SECURE.DAT has the read-only, hidden, and archive attributes set, %@ATTRIB[SECURE.DAT] would return "RH_A_" (without the quotes).  If the file does not exist, @ATTRIB will return an empty string.


@CDROM
@CDROM[d:]:  Returns "1" if the drive is a CD-ROM or "0" otherwise.


@CHAR
@CHAR[n]:  Returns the character corresponding to an ASCII numeric value.  For example %@CHAR[65] returns A.


@COMMA
@COMMA[n]:  Returns the number with commas (or the appropriate thousands separator for your current country setting) inserted where appropriate.


@DATE
@DATE[mm-dd-yy]:  Returns the number of days since January 1, 1980 for the specified date.  DATE uses the date format and separators mandated by your country code (for example dd.mm.yy in Germany, or  yy-mm-dd in Japan).


@DEC
@DEC[%var]:  Returns the same value as @EVAL[%var - 1].  That is, it retrieves and decrements the value of a variable.  The variable itself is not changed; to do so, use a command like this:

set var=%@dec[%var]


@DESCRIPT
@DESCRIPT[filename]:  Returns the file description for the specified filename (see DESCRIBE).


@DEVICE
@DEVICE[name]:  Returns "1" if the specified name is a character device (such as a printer or serial port), or "0" if not.


@DISKFREE
@DISKFREE[d:,b|k|m]: Returns the amount of free disk space on the specified drive.


@DISKTOTAL
@DISKTOTAL[d:,b|k|m]:  Returns the total disk space on the specified drive.


@DISKUSED
@DISKUSED[d:,b|k|m]:  Returns the amount of disk space in use by files and directories on the specified drive.


@DOSMEM
@DOSMEM[b|k|m]:  Returns the size of the largest free memory block (either in physical or virtual memory).


@EVAL
@EVAL[expression]:  Evaluates an arithmetic expression.  @EVAL supports addition (+), subtraction (), multiplication (*), division (/), integer division (\, returns the integer part of the quotient), modulo (%%), and integer exponentiation (**).  The expression can contain environment variables and other variable functions.  @EVAL also supports parentheses, commas, and decimals.  Parentheses can be nested. @EVAL will strip leading and trailing zeros from the result.  When evaluating expressions, **, *, /, and %% take precedence over + and -.  For example, 3 + 4 * 2 will be interpreted as 3 + 8, not as 7 * 2.  To change this order of evaluation, use parentheses to specify the order you want.

The maximum precision is 16 digits to the left of the decimal point and 0 to 8 digits to the right of the decimal point.  You can alter the default precision with the EvalMax and EvalMin directives in TCMD.INI and with the SETDOS /F command.

You can alter the precision for a single evaluation with the construct @EVAL[expression=x.y].  The x value specifies the the minimum decimal precision (the minimum number of decimal places displayed); the y value sets the maximum decimal (rounding) precision.  If x is greater than y, it is ignored.  You can specify either or both arguments: @EVAL[3/7=2], @EVAL[3/7=2.4], or @EVAL[3/7=.4].

Also see @DEC and @INC.


@EXEC
@EXEC[command]:  Execute the command and return the numeric exit code.  The command can be an alias, internal command, external command, .BTM file, or .BAT file.  @EXEC is primarily intended for running a program from within the PROMPT.  It is a "back door" entry into command processing and should be used with extreme caution.  Incorrect or recursive use of @EXEC may hang your system.


@EXT
@EXT[filename]:  Returns the extension from a file name, without a leading period.


@FILEAGE
@FILEAGE[filename]:  Returns the date and time of the file as a single numeric value.  The number can be used to compare the relative ages of two or more files.


@FILECLOSE
@FILECLOSE[n]:  Closes the file whose handle is "n."  You cannot close handles 0, 1 or 2.  Returns "0" if the file closed OK or "-1" if an error occurred.  Be sure to read the cautionary note about file functions under Variable Functions.


@FILEDATE
@FILEDATE[filename]:  Returns the date a file was last modified, in the default country format (mm-dd-yy for the US).


@FILENAME
@FILENAME[filename]:  Returns the name and extension of a file, without a path.


@FILEOPEN
@FILEOPEN[filename, read | write | append[,b|t]]:  Opens the file in the specified mode and returns the file handle as an integer.  If you add "b" the file is opened in binary mode;  "t" means text mode, the default.  In binary mode, no special translation of CR/LF pairs is performed.  Returns "-1" if the file cannot be opened.  Be sure to read the cautionary note about file functions under Variable Functions.


@FILEREAD
@FILEREAD[n[,length]]:  Reads a line or a series of bytes from the file whose handle is "n."  Returns "**EOF**" if you attempt to read past the end of the file.  If length is not given @FILEREAD reads up to the next CR or LF character.  If length is given @FILEREAD reads the specified number of bytes regardless of whether CR or LF characters are found.  Be sure to read the cautionary note about file functions under Variable Functions.


@FILES
@FILES[filename [,-nrhsda]]:  Returns the number of files that match the filename specification, which may contain wildcards and include lists.  The filename must refer to a single directory; to check several directories, use @FILES once for each directory, and add the results together with @EVAL. The second argument, if included, defines the attributes of the files that will be included in the search.  Returns an empty string if no files match.  The attributes are:

N	Normal (no attributes set)

R	Read-only

H	Hidden

S	System

D	Directory

A	Archive

The attributes (other than N) can be combined (for example %@FINDFIRST[MYFILE,HS]).  @FINDFIRST will only find a file if all of the attributes match.  You can prefix an attribute with "-" to mean "everything except files with this attribute."


@FILESEEK
@FILESEEK[n,offset,start]:  Moves the file pointer "offset" bytes in the file whose handle is "n".  Returns the new position of the pointer, in bytes from the start of the file.  Set "start" to 0 to seek relative to the beginning of the file, 1 to seek relative to the current file pointer, or 2 to seek relative to the end of the file.  The offset value may be negative (seek backward), positive (seek forward), or zero (return current position, but do not change it).  Be sure to read the cautionary note about file functions under Variable Functions.


@FILESEEKL
@FILESEEKL[n,line]:  Moves the file pointer to the specified line in the file whose handle is "n". Returns the new position of the pointer, in bytes from the start of the file. Be sure to read the cautionary note about file functions under Variable Functions


@FILESIZE
@FILESIZE[filename,b|k|m]:  Returns the size of a file, or "-1" if the file does not exist.  If the filename includes wildcards or an include list, returns the combined size of all matching files.


@FILETIME
@FILETIME[filename]:  Returns the time a file was last modified, in hh:mm format.


@FILEWRITE
@FILEWRITE[n,text]:  Writes a line to the file whose handle is "n".  Returns the number of bytes written, or "-1" if an error occurred.  Be sure to read the cautionary note about file functions under Variable Functions.


@FILEWRITEB
@FILEWRITEB[n.length,string]:  Writes the specified number of bytes from the string to the file whose handle is "n".  Returns the number of bytes written, or "-1" if an error occurred.  Be sure to read the cautionary note about file functions under Variable Functions.


@FINDFIRST
@FINDFIRST[filename [,[-]nrhsda]]:  Returns the name of the first file that matches the filename, which may include wildcards and/or an include list.  The second argument, if included, defines the attributes of the files that will be included in the search.  Returns an empty string if no files match.  The attributes are:

N	Normal (no attributes set)

R	Read-only

H	Hidden

S	System

D	Directory

A	Archive

The attributes (other than N) can be combined (for example %@FINDFIRST[MYFILE,HS]).  @FINDFIRST will only find a file if all of the attributes match.  You can prefix an attribute with "-" to mean "everything except files with this attribute."


@FINDNEXT
@FINDNEXT[[filename [,[-]nrhsda]]]:  Returns the name of the next file that matches the filename(s) in the previous @FINDFIRST call.  The second argument, if included, defines the attributes of the files that will be included in the search (see @FINDFIRST for details). Returns an empty string when no more files match.  @FINDNEXT should only be used after a successful call to @FINDFIRST.  You do not need to include the filename parameter, because it must be the same as the previous @FINDFIRST call, unless you also want to specify file attributes for @FINDNEXT.


@FORMAT
@FORMAT[[-][x][.y],string]:  Reformats a string, truncating it or padding it with spaces as necessary.  If you use the minus [-], the string is left-justified; otherrwise, it is right-justified.  The x value is the minimum number of characters in the result.  The y value is the maximum number of characters in the result.  You can combine the options as necessary.  For example, Echo %@format[7,Hello] displays "  Hello" while Echo %@format[.3,Hello] displays "Hel".


@FULL
@FULL[filename]:  Returns the fully qualified path name of a file.


@GETDIR
@GETDIR[d:\path]:  Pops up a dialog box to select a directory.  "d:\path" specifies the initial directory; if it is not specified, GETDIR defaults to the current directory.  Returns the chosen directory as a string, or an empty string if the user selects "Cancel" or presses Esc.


@GETFILE
@GETFILE[d:\path\filename[,filter]]:  Pops up a dialog box to select a file.  "d:\path\filename" specifies the initial directory and filename shown in the dialog, and may include wildcards.  If it is not specified, GETDIR defaults to *.* in the current directory.  Returns the full path and name of the selected file or an empty string if the user selects "Cancel" or presses Esc.  The optional second argument specifies the file extension to use.  You can specify multiple extensions by separating them with a semicolon.  For example, %@getfile[c:\windows,*.exe;*.btm] lets the user select from .EXE and .BTM files only.


@IF
@IF[condition,true,false]:  Evaluates the condition and returns a string based on the result.  The condition can include any of the tests allowed in the IF command.  If the condition is true, @IF returns the first result string; if it is false, @IF returns the second string.  For example, %IF[2==2,Correct!,Oops!] returns "Correct!"


@INC
@INC[%var]:  Returns the same value as %@EVAL[%var + 1].  That is, it retrieves and increments the value of a variable.  The variable itself is not changed; to do so, use a command like this:

set var=%@inc[%var]


@INDEX
@INDEX[string1,string2]:  Returns the position of string2 within string1, or "-1" if string2 is not found.  The first position in string1 is numbered 0.


@INIREAD
@INIREAD[filename,section,entry]:  Returns an entry from the specified .INI file or an empty string if the entry does not exist.  For example, %@iniread[c:\tcmd\tcmd.ini,TakeCommand,history] returns the size of the command history if it is specified in TCMD.INI.  If you don't specify a path for the .INI file, @INIREAD will look in the Windows and Windows\System directories.


@INIWRITE
@INIWRITE[filename,section,entry,string]:  Creates or updates an entry in the specified .INI file.  For example, %@iniwrite[c:\tcmd\tcmd.ini,TakeCommand,history,2048] will set the size of the command history to 2,048 bytes the next time Take Command is started.  Returns "0" for success or "-1" for failure.  If you don't specify a path for the .INI file, @INIWRITE will look in the Windows and Windows\System directories.


@INSTR
@INSTR[start, length, string]:  The same as @SUBSTR.  However, the string is at the end of the @INSTR argument list, so that commas in the string will not be confused with commas separating the arguments.


@INT
@INT[n]:  Returns the integer part of the number n.


@LABEL
@LABEL[d:]:  Returns the volume label of the specified disk drive.


@LEN
@LEN[string]:  Returns the length of a string.


@LINE
@LINE[filename,n]:  Returns line "n" from the specified file. The first line in the file is numbered 0.  "**EOF**" is returned for all line numbers beyond the end of the file.  If you need to scan through the lines of a file in sequence, the @FILEREAD function (above) and the "@filename" construct available in the FOR command are much faster than calling the @LINE function repeatedly.  @LINE will retrieve input from standard input if you specify CON as the filename.  If you are redirecting input to @LINE using this feature, you must use command grouping or the redirection will not work properly.  For example:

(echo %@line[con,0]) < myfile.dat


@LINES
@LINES[filename]:  Returns the line number of the last line in the file, or "-1" if the file is empty.  The first line in the file is numbered 0, so (for example) @LINES will return 0 for a file containing one line.


@LOWER
@LOWER[string]:  Returns the string converted to lower case.


@LPT
@LPT[n]:  Returns 1 if the specified printer is ready.


@MAKEAGE
@MAKEAGE[date[,time]]:  Returns the date and time (if included) as a single value in the same format as @FILEAGE.  Can be used to compare the time stamp of a file with a specific date and time.


@MAKEDATE
@MAKEDATE[n]:  Returns a date (formatted according to the current country settings).  "n" is the number of days since 1/1/80. This is the inverse of @DATE.


@MAKETIME
@MAKETIME[n]:  Returns a time (formatted according to the current country settings).  "n" is the number of seconds since midnight.  This is the inverse of @TIME.


@NAME
@NAME[filename]:  Returns the base name of a file, without the path or extension.


@NUMERIC
@NUMERIC[string]:  Returns "1" if the argument is composed entirely of digits (0 to 9), signs (+ or ), and the thousands and decimal separators.  Otherwise, returns "0".


@PATH
@PATH[filename]:  Returns the path from a file name, including the drive letter and a trailing backslash but not including the base name or extension.


@RANDOM
@RANDOM[min, max]:  Returns a random value between min and max, inclusive.  Min, max, and the returned value are all integers.


@READSCR
@READSCR[row,col,length]:  Returns the text displayed on the screen at the specified location.  The upper left corner of the screen is location 0,0.

You can also specify the row and column as offsets from the current cursor position.  Begin the value with a plus sign [+] to read the screen the specified number of rows below (or columns to the right of) the current position, or with a minus sign [-] to read the screen above (or to the left of) the current position.


@READY
@READY[d:]:  Returns "1" if the specified drive is ready; otherwise returns "0".


@REMOTE
@REMOTE[d:]:  Returns "1" if the specified drive is a remote (network) drive; otherwise returns "0".


@REMOVABLE
@REMOVABLE[d:]:  Returns "1" if the specified drive is removable (i.e., a floppy disk or removable hard disk); otherwise returns "0".


@REPEAT
@REPEAT[c,n]:  Returns the character "c" repeated "n" times.


@SEARCH
@SEARCH[filename]:  Searches for the filename using the PATH environment variable, appending an extension if one isn't specified.  Returns the fully-expanded name of the file including drive, path, base name, and extension, or an empty string if a matching file is not found.  If wildcards are used in the filename, @SEARCH will search for the first file that matches the wildcard specification, and return the drive and path for that file plus the wildcard filename (e.g., E:\UTIL\*.COM ).  (See the PATH command for details on the default extensions used when searching the PATH, the order in which the search proceeds, and the search of the \WINDOWS and \WINDOWS\SYSTEM directories.)


@SELECT
@SELECT[filename,top,left,bottom,right,title]:  Pops up a selection window with the lines from the specified file. Returns the text of the line the scrollbar is on if you press Enter, or an empty string if you press Esc.  @SELECT can be used to display menus or other selection lists from a batch file.  To select from lines passed through input redirection or a pipe, use CON as the filename.  You can move through the selection window with standard navigation keystrokes.  To change the navigation keys, see the Key Mapping directives in the .INI file.


@SUBSTR
@SUBSTR[string,start,length]:  Returns a substring, starting at the position "start" and continuing for "length" characters.  If the length is omitted, it will default to the remainder of the string.  If the length is negative, the start is relative to the right side of the string.  The first character in the string is numbered 0; if the length is negative, the last character is numbered 0.  For example, %@SUBSTR[%_TIME,0,2] gets the current time and extracts the hour.  If the string includes commas, it must be quoted with double quotes ["] or back quotes [`].  The quotes do count in calculating the position of the substring. @INSTR performs the same function, and allows commas in the string without quoting.


@TIME
@TIME[hh:mm:ss]:  Returns the number of seconds since midnight for the specified time.  The time must be in 24-hour format; "am" and "pm" cannot be used.


@TIMER
@TIMER[n]:  Returns the current split time for a stopwatch started with the TIMER command.  The value of n specifies the timer to read and can be 1, 2, or 3.


@TRIM
@TRIM[string]:  Returns the string with the leading and trailing white space (space and tab characters) removed.


@UNIQUE
@UNIQUE[d:\path]:  Creates a zero-length file with a unique name in the specified directory, and returns the full name and path.  If no path is specified, the file will be created in the current directory.  The file name will be FAT-compatible (8 character name and 3-character extension) regardless of the type of drive on which the file is created.  This function allows you to create a  temporary file without overwriting an existing file.


@UPPER
@UPPER[string]:  Returns the string converted to upper case.


@WORD
@WORD[["xxx",]n,string]:  Returns the "nth" word in a string.  The first word is numbered 0.  If "n" is negative, words are returned from the end of the string.  You can use the first argument, "xxx" to specify the separators that you wish to use.  If you want to use a double quote as a separator, prefix it with an escape character.  If you don't specify a list of separators, @WORD will consider only spaces, tabs, and commas as word separators.  For example:

%@WORD[2,NOW IS THE TIME]	returns "THE"

%@WORD[-0,NOW IS THE TIME]	returns "TIME"

%@WORD[-2,NOW IS THE TIME]	returns "IS"

%@WORD["=",1,2 + 2=4]	returns "4"


@WORDS
@WORDS[["xxx"],string]:  Returns the number of words in the string.  The optional list of delimiters follows the same format as @WORD.  If the string argument is enclosed in quotation marks, you must enter a list of delimiters as well.


Startup

You will typically start Take Command from an item in one of the Program Manager groups on your Windows desktop, or from a similar item in your Windows shell (if you dont use Program Manager).  Usually a single item is sufficient, but if you wish you can create multiple items to start Take Command in different modes, with different startup commands or options, or to run different batch files or other commands.  You can use these items to run commonly-used commands and batch files directly from the Windows desktop.

Each item or icon represents a different Take Command window.  You can set any necessary command line parameters for Take Command such as a command to be executed, any desired switches, and the name and path for TCMD.INI.  More information on command line switches and options for Take Command is included later in this topic.

For general information on creating and configuring Program Manager items, see your Windows documentation.  If you are using the Windows Program Manager to configure a Take Command item, use the New selection on the File menu to create a new item.  Use the Properties selection on the File menu to adjust the configuration of an existing item.  If you are using an alternate shell rather than Program Manager, use the appropriate configuration method for your shell.

When you configure a Take Command item, place the full path and name for the TCMD.EXE file in the Command Line field, and put any startup options that you want passed to Take Command (e.g., the name of a startup batch file) after the TCMD.EXE file name.  For example:

Command Line:	C:\TCMD10\TCMD.EXE C:\GO.BAT

Working directory:	C:\

You do not need to use the Change Icon button, because TCMD.EXE already contains an icon.

When Take Command starts it automatically runs the optional TCSTART batch file.  You can use this file to load aliases and environment variables and otherwise initialize Take Command.

You can also place the name of a batch file, internal or external command, or alias at the end of the Command Line field for any item (as shown in the example above).  The batch file, command, or alias will be executed after TCSTART but before the first prompt is displayed.

Like DOS programs, each Windows program has a command line which can be used to pass information to the program when it starts.  The command line is entered in the Command Line field for each item in a Program Manager group (or each item defined under another Windows shell), and consists of the name of the program to execute, followed by any startup options.

The Take Command startup command line does not need to contain any information.  When invoked with an empty command line, Take Command will configure itself from the TCMD.INI file, run TCSTART, and then display a prompt and wait for you to type a command.  However, you may add information to the startup command line that will affect the way Take Command operates.

Take Command recognizes three optional fields on the command line.  If you use more than one of these fields, their order is important.  The syntax for the command line is:

[@d:\path\inifile] [//iniline]... [/C] [command]

The options are:

@d:\path\inifile:  This option sets the path and name of the TCMD.INI file.  You do not need this option if you aren't using a TCMD.INI file, or if the file is named TCMD.INI and is stored in the same subdirectory as TCMD.EXE or in the Windows directory.

//iniline:  This option tells Take Command to treat the text appearing between the // and the next space or tab as a TCMD.INI directive.  The directive should be in the same format as a line in the [TakeCommand] section of TCMD.INI, but it may not contain spaces, tabs, or comments.  This option overrides any corresponding directive in your TCMD.INI file.

[/C] command:  This option tells Take Command to run a command when it starts.  The command will be run after TCSTART 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 Take Command 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, Take Command will execute the command and then exit and return to the parent program or the Windows desktop without displaying a prompt.

To run a specific startup batch file or other command when a particular Take Command item is started, include the batch file or command name (with a path, if the file is not in the startup directory) as the last item in the Command Line field.  The batch file or command will be executed after any TCSTART file, but before the first prompt is displayed.

You can use this capability to run a specific batch file or command for a particular item (as opposed to TCSTART, which is run every time Take Command starts).

For example, to run C:\STARTUP.BAT when the item starts:

Command Line:	C:\TCMD\TCMD.EXE STARTUP.BAT

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:

Command Line:	D:\TCMD\TCMD.EXE /C COMFILES.BTM

Working directory:	C:\


TCMD.INI

The configuration of Take Command is controlled through an optional file of initialization information called TCMD.INI.  You can modify this file manually with an ASCII editor, but you will probably find it easier and faster to modify it using the configuration dialogs, available on the Options menu.

The .INI file has several sections.  All of the directives described here go into in the [TakeCommand] section, which is usually first in the file.  You can edit this section manually.  Take Command uses the other sections to record information you set while you are using it, including its window size and position, the font you are using, and the buttons you create on the tool bar.  You should use Take Command's menu commands to change the settings in these other sections of the .INI file instead of editing them directly.

The Advanced directives, the Key Mapping directives, and a few other individual directives do not have corresponding fields in the configuration dialogs, and must be entered manually (this is noted for each individual directive which requires manual entry).

This topic contains general information on TCMD.INI. For information on specific directives see the separate topic for each type of directive:

Initialization Directives

Configuration Directives

Color Directives

Key Mapping Directives

Advanced Directives

These topics list the directives, with a one-line description of each, and a cross-reference which selects a full screen help topic on that directive. A few of the directives are simple enough that the one-line description is sufficient, but in most cases you should check for any additional information in the cross-reference topic if you are not already familiar with the directive.

You can also obtain help on most directives with a HELP directive command at the prompt.

Take Command reads TCMD.INI when it starts, and configures itself accordingly.  The file is not re-read when you change it manually.  For changes to take effect, you must restart Take Command.  However, if you make changes with the configuration dialogs those changes will take effect immediately.

Each item that you can include in the [TakeCommand] section of TCMD.INI has a default value.  You only need to include entries in this sectiion for settings that you want to change from their default values.  If you are happy with all of the default values, you can leave the [TakeCommand] section of the file empty.

Take Command searches for TCMD.INI in three places:

1)	If there is an "@d:\path\inifile" option on the Take Command startup command line Take Command will use the path and file name specified there, and will not look elsewhere.

2)	If there is no .INI file name on the startup command line, the search proceeds to the same directory where the Take Command program file (TCMD.EXE ) is stored.  This is the "normal" location for the .INI file.  Take Command determines this directory automatically.

3)	If the .INI file is not found in the directory where the program file is stored, a final check is made in the Windows directory.

Most lines in the .INI file consist of a one-word directive, an equal sign [=], and a value.  For example, in the following line, the word "History" is the directive and "2048" is the value:

History = 2048

Any spaces before or after the equal sign are ignored.

If you have a long string to enter in the .INI file (for example, for the ColorDir directive), you must enter it all on one line.  Strings cannot be "continued" to a second line.  Each line may be up to 1023 characters long.

The format of the value part of a directive line depends on the individual directive.  It may be a numeric value, a single character, a choice (like "Yes" or "No"), a color setting, a key name, a path, a filename, or a text string.  The value begins with the first non-blank character after the equal sign and ends at the end of the line or the beginning of a comment.

Blank lines are ignored in the .INI file and can be used to separate groups of directives.  You can place comments in the file by beginning a line with a semicolon [;].  You can also place comments at the end of any line except one containing a text string value.  To do so, enter at least one space or tab after the value, a semicolon, and your comment, like this:

History = 2048       ;set history list size

If you try to place a comment at the end of a string value, the comment will become part of the string and will probably cause an error.

When Take Command detects an error while processing the .INI file, it displays an error message and prompts you to press a key to continue processing the file.  This allows you to note any errors before the startup process continues.  The directive in error will retain its previous or default value.  Only the most catastrophic errors (like a disk read failure) will terminate processing of the remainder of the .INI file.  If you don't want a pause after each error, use a PauseOnError = No directive at the beginning of the .INI file.

If you need to test different values for an .INI directive without repeatedly editing the .INI file, see INIQuery.

The SETDOS command can override several of the .INI file directives.  For example, the cursor shape used by Take Command can be adjusted either with the CursorIns and CursorOver directives or the SETDOS /S command.  The correspondence between SETDOS options and .INI directives is noted under each directive below, and under each option of the SETDOS command.


Initialization Directives

The directives in this section control how Take Command starts and where it looks for its files.  The initialization directives are:

DirHistory	Size of directory history list

History	Size of history list

INIQuery	Query for each line in TCMD.INI

PauseOnError	Pause on errors in TCMD.INI

ScreenBufSize	Size of screen buffer.

TCStartPath	Path for TCSTART and TCEXIT

WindowState	Initial state for the Take Command window

WindowX, WindowY, WindowWidth, WindowHeight

Initial size and position of the Take Command window


DirHistory
DirHistory = nnnn (256):  Sets the amount of memory allocated to the directory history list in bytes.  The allowable range of values is 128 to 2048.  If you use a global directory history list (see Directory History Window), the DirHistory value is ignored in all sessions except that which fist establishes the global list.


History (directive)
History = nnnn (1024):  Sets the amount of memory allocated to the command history list in bytes.  The allowable range of values is 256 to 8192 bytes.


INIQuery
INIQuery = Yes | NO:  If set to Yes, a prompt will be displayed before execution of each subsequent line in the current .INI file.  This allows you to modify certain directives when you start Take Command in order to test different configurations.  INIQuery can be reset to No at any point in the file.  Normally INIQuery = Yes is only used during testing of other .INI file directives.

The prompt generated by INIQuery = Yes is:

[contents of the line]  (Y/N/Q/R/E)  ?

At this prompt, you may enter:

Y = Yes:	Process this line and go on to the next.

N = No:	Skip this line and go on to the next.

Q = Quit:	Skip this line and all subsequent lines.

R = Rest:	Execute this and all subsequent lines.

E = Edit:	Edit the value for this entry.

If you choose E for Edit, you can enter a new value for the directive, but not a new directive name.


PauseOnError
PauseOnError = YES | No:  Yes forces a pause with the message "Error in filename, press any key to continue processing" after displaying any error message related to a specific line in the .INI file.  No continues processing with no pause after an error message is displayed.


ScreenBufSize
ScreenBufSize = nnnn (64000):  Sets the size of the screen scrollback buffer in bytes.  The allowable range is from 16000 to 64000 bytes.


TCStartPath
TCStartPath = Path:  Sets the drive and directory where the TCSTART and TCEXIT batch files (if any) are located.


WindowState
WindowState = STANDARD | Maximize | Minimize | Custom:  Sets the initial state of the Take Command window.  Standard puts the window in the default position on the Windows desktop, and is the default setting. Maximize maximizes the window; Minimize minimizes it, and Custom sets it to the position specified by the WindowX, WindowY, WindowWidth, WindowHeight directives.


WindowX, WindowY, WindowWidth, WindowHeight
WindowX = nnnn, WindowY = nnnn, WindowWidth = nnnn, WindowHeight = nnnn:  These 4 directives set the initial size and position of the Take Command window.  The measurements are in pixels or pels.  WindowX and WindowY refer to the position of the top left corner of the window relative to the top left corner of the screen.  These directives will be ignored unless WindowState is set to Custom.


Configuration Directives

These directives control the way that Take Command operate.  Some can be changed with the SETDOS command while Take Command is running. Any corresponding SETDOS command is listed in the description of each directive.  The configuration directives are:

AmPm	Time display format

BatchEcho	Default batch file echo state

BeepFreq	Default beep frequency

BeepLength	Default beep length

CommandSep	Multiple command separator character

CursorIns	Cursor width in insert mode

CursorOver	Cursor width in overstrike mode

DescriptionMax	Maximum length of file descriptions

DescriptionName	Name of file to hold file descriptions

Descriptions	Enable / disable description processing

EditMode	Editing mode (insert / overstrike)

Editor	Program to run for "Editor" menu choice

EvalMax	Maximum precision returned by @EVAL

EvalMin	Minimum precision returned by @EVAL

ExecWait	Forces Take Command to wait for external programs to complete

EscapeChar	Take Command escape character

HistCopy	History copy mode

HistLogName	History log file name

HistMin	Minimum command length to save

HistWinHeight	History window height

HistWinLeft	History window left side position

HistWinTop	History window top position

HistWinWidth	History window width

IBeamCursor	Change the default text cursor to an arrow

LogName	Log file name

NoClobber	Overwrite protection for output redirection

ParameterChar	Alias / batch file parameter character

ProgmanDDE	Establish communications with Program Manager

PromptShellExit	Control exit prompting when Take Command is the shell

ScreenColumns	Virtual screen width

ScrollLines	Number of lines to scroll up when at the bottom of the window

StatusBarOn	Set status bar mode at startup

StatBarText	Point size of status bar text

SwapScrollKeys	Switch to 4DOS-style history and scrolling keys

TabStops	Sets the tab positions for Take Command's output.

ToolBarOn	Set toolbar mode at startup

ToolBarText	Point size of toolbar text

UpperCase	Force file names to upper case


AmPm
AmPm = Yes | NO | Auto:  Yes displays times in 12-hour format with a trailing "a" for AM or "p" for PM.  The default of No forces a display in 24-hour time format.  Auto formats the time according to the country code set for your system.  AmPm controls the time displays used by DIR and SELECT, in LOG files, and the output of the TIMER, DATE, and TIME commands.  It has no effect on %_TIME, %@MAKETIME, the $t and $T options of PROMPT, or date and time ranges.


BatchEcho
BatchEcho = YES | No:  Sets the default batch echo mode. Yes enables echoing of all batch file commands unless ECHO is explicitly set off in the batch file.  No disables batch file echoing unless ECHO is explicitly set on.  Also see SETDOS /V.


BeepFreq
BeepFreq = nnnn (440):  Sets the default BEEP command frequency in Hz.  This is also the frequency for "error" beeps (for example, if you press an illegal key).  To disable all error beeps set this or BeepLength to 0.  If you do, the BEEP command will still be operable, but will not produce sound unless you explicitly specify the frequency and duration.


BeepLength
BeepLength = nnnn (2):  Sets the default BEEP length in system clock ticks (approximately 1/18 of a second per tick). BeepLength is also the default length for "error" beeps (for example, if you press an illegal key).


CommandSep
CommandSep = c:  This is the character used to separate multiple commands on the same line.  The default for Take Command is the caret [^]; the default for Take Command/32 is the ampersand [&]. You cannot use any of the redirection characters (| > < ) or any of the whitespace characters (space, tab, comma, or equal sign).  Also see SETDOS /C, the %+ internal variable, and 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for information on using compatible command separators for two or more products.


CursorIns
CursorIns = nnnn (15):  This is the width of the cursor for insert mode during command-line editing and all commands which accept line input (DESCRIBE, ESET, etc.).  The size is a percentage of the total character cell size, between 0% and 100%.  Because of the way video drivers map the cursor shape, you may not get a smooth progression in cursor shapes as CursorIns and CursorOver change.  If you set CursorIns and CursorOver to -1, the cursor shape won't be modified at all.  If you set them to 0, the cursor will be invisible.  Also see SETDOS /S.


CursorOver
CursorOver = nnnn (100):  This is the width of the cursor for overstrike mode during command-line editing and all commands which accept line input.  The size is a percentage of the total character cell size, between 0% and 100%.  For more details see the CursorIns directive; also see SETDOS /S.


DescriptionMax
DescriptionMax = nnnn (511):  Controls the description length limit for DESCRIBE.  The allowable range is 20 to 511 characters.


DescriptionName
DescriptionName = File:  Sets the name of the hidden file in each directory that will hold file descriptions.  If you don't use this directive, the description files will be named DESCRIPT.ION.  This directive cannot be entered via the configuration dialogs; you must enter it manually (see TCMD.INI for details).  Use this directive with caution, because changing the name from the default will make it difficult to transfer file descriptions to another system.  Also see SETDOS /D.


Descriptions
Descriptions = YES | No:  Turns description handling on or off during the file processing commands COPY, DEL, MOVE, and REN.  If set to No, Take Command will not update the description file when files are moved, copied, deleted or renamed.  Also see SETDOS /D.


EditMode
EditMode = INSERT | Overstrike:  This directive lets you start the command-line editor in either insert or overstrike mode.  Also see SETDOS /M.


Editor
Editor = File:  Specifies the path and filename of the program that Take Command will execute when you select "Editor" from the Utilities menu.  The defaul is NOTEPAD.EXE.


EvalMax
EvalMax = nnnn (8):  Controls the maximum number of digits after the decimal point in values returned by @EVAL.  You can override this setting with the construct @EVAL[expression=n,n].  The allowable range is 0 to 8.  Also see SETDOS /F.


EvalMin
EvalMin = nnnn (0):  Controls the minimum number of digits after the decimal point in values returned by @EVAL.  The allowable range is 0 to 8.  This directive will be ignored if EvalMin is larger than EvalMax.  You can override this setting with the construct @EVAL[expression=n,n].  Also see SETDOS /F.


ExecWait
ExecWait = Yes | NO:  Controls whether Take Command waits for an external program to complete before redisplaying the prompt.

This setting applies only to applications started from the Take Command prompt, including DOS applications which are not run under Caveman.  Take Command will always wait for applications run from batch files, and for DOS applications started under Caveman.  ExecWait also has no effect on applications started with the START command, which has its own separate /WAIT switch.


EscapeChar
EscapeChar = c:  Sets the character used to suppress the normal meaning of the following character.  The default for Take Command is a Ctrl-X; the default for Take Command/32 is a caret [^]. See Escape Character for a description of special escape sequences.  You cannot use any of the redirection characters (|, >, or < ) or the whitespace characters (space, tab, comma, or equal sign) as the escape character.  Also see SETDOS /E, the %= internal variable, and 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for information on using compatible escape characters for two or more products.


HistCopy
HistCopy = Yes | NO:  Controls what happens when you re-execute a line from the command history.  If this option is set to Yes, the line is appended to the end of the history list.  By default, or if this option is set to No, no copy of the command is made.  The original copy of the command is always retained at its original position in the list, regardless of the setting of HistCopy.


HistLogName
HistLogName = File:  Sets the history log file name and path.  Using HistLogName does not turn history logging on; you must use a LOG /H ON command to do so.


HistMin
HistMin = nnnn (0):  Sets the minimum command-line size to save in the command history list.  Any command line whose length is less than this value will not be saved.  Legal values range from 0, which saves everything, to 256, which disables all command history saves.


HistWinHeight
HistWinHeight = nn (12):  Sets the height of the command-line and directory history windows in lines, including the border.  Legal values range from 5 to the height of your Take Command window.


HistWinLeft
HistWinLeft = nn (20):  Sets the horizontal position of the left side of the command-line and directory history windows.  Legal values range from 0 (the left edge of the Take Command window) to the number of columns in your Take Command window minus 10.


HistWinTop
HistWinTop = nn (1):  Sets the vertical position of the top of the command-line and directory history windows.  Legal values range from 0 (the top of the Take Command window) to the number of rows in your Take Command window minus 5.


HistWinWidth
HistWinWidth = nn (36):  Sets the width of the command-line and directory history windows in characters, including the border. Legal values range from 10 to the width of your Take Command window.


IBeamCursor
IBeamCursor = YES | No:  If set to Yes, Take Command will display the standard "I-Beam" cursor in text areas of its window.  If IBeamCursor is set to No, an arrow is used in all areas of the window.  This option is intended for LCD screens where the I-beam cursor may be hard to see.


LogName
LogName = File:  Sets the log file name and path.  Using LogName does not turn logging on; you must use a LOG ON command to do so.


NoClobber
NoClobber = Yes | NO:  If set to Yes, will prevent standard output redirection from overwriting an existing file, and will require that the output file already exist for append redirection.  Also see SETDOS /N.


ParameterChar
ParameterChar = c:  Sets the character used after a percent sign to specify all or all remaining command-line arguments in a batch file or alias (e.g., %& or %n&; see Batch Files and ALIAS).  The default in Take Command is ampersand [&]; the default in Take Command/32 is the dollar sign [$].  Also see SETDOS /P.  See 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for information on using compatible parameter characters for two or more products.


ProgmanDDE
ProgmanDDE = Yes | No | AUTO:  Sets the method Take Command uses to retrieve group names and data for the Apps and Windows menus.  If set to Auto, Take Command first tries to establish DDE communications with Program Manager (or a replacement Windows shell which emulates it).  If the DDE link fails, Take Command will try to read the Program Manager's .GRP (group) files directly.  If set to Yes, Take Command will use DDE and ignore the .GRP files.  If set to No, Take Command will read the .GRP files and not attempt to use DDE communications.

If your Windows shell supports Program Manager DDE and does not keep the Program Manager .GRP files up to date, you may want to set ProgManDDE to Yes to prevent use of the .GRP files.

If your Windows shell does not support Program Manager DDE you may find that Take Command's Apps menu takes a long time to display, because Take Command must wait to see if Program Manager is responding.  In this case set ProgManDDE to No and Take Command will read the Program Manager .GRP files immediately, without waiting for a DDE response.

Some Windows shells (for example, HP Dashboard) start Program Manager whenever an application attempts to send a Program Manager DDE message.  If you have this type of shell you will see Program Manager start when you try to use Take Command's Apps menu.  To avoid this side effect, set ProgManDDE to No.


PromptShellExit
PromptShellExit = Yes | NO:  If set to Yes, Take Command will prompt before exiting Windows when it is set up as the Windows shell (see Take Command and Windows Shells).  If set to No (the  default), Take Command will exit Windows without prompting.


ScreenColumns
ScreenColumns = nnnn:  Sets the number of virtual screen columns used by the video display.  If the virtual window width is greater than the physical window width, Take Command will display a horizontal scrollbar at the bottom of the window.  If you attempt to drag the right margin to a size greater than the virtual screen width, Take Command will resize the window to the virtual width.  The default value is 80.


ScrollLines
ScrollLines = nnnn (2):  Sets the number of lines displayed before the screen is physically scrolled.  Take Command will scroll up when output reaches the bottom of the window. Higher values will speed up the display but also make it jerky; lower values will make scrolling smoother but will slow it down.


StatusBarOn
StatusBarOn = YES | No:  Yes enables the status bar when Take Command starts.  No disables it.  The status bar can always be enabled or disabled while Take Command is running by using the Settings menu.


StatBarText
StatBarText = nnnn (8):  Sets the point size of the text on the status bar.  The allowable range is 4 to 16.


SwapScrollKeys
SwapScrollKeys = Yes | NO:  Yes switches to 4DOS-style keystrokes for manipulating the scrollback buffer.

If SwapScrollKeys is set to Yes, the Up and Down arrow keys will scroll through the command history list and the PgUp key will pop up the history window.  The Ctrl-Up, Ctrl-Down, Ctrl-PgUp, and Ctrl-PgDn keys will scroll the text in the screen buffer.

If SwapScrollKeys is set to No, these keys will assume their default meanings.  The Up and Down arrow keys and the PgUp and PgDn keys will scroll the text in the screen buffer.  The Ctrl-Up and Ctrl-Down keys will scroll through the command history list and the Ctrl-PgUp key will pop up the history window.

For additional details see Scrolling and History Keystrokes.

Do not set SwapScrollKeys to Yes if you use key mapping directives to reassign the scrolling or history keys individually.  SwapScrollKeys takes effect before other key mappings, and using both methods at the same time will be confusing at best.  Setting SwapScrollKeys to Yes has essentially the same effect as including the following key mapping directives in TCMD.INI individually:

PrevHistory = Up

NextHistory = Down

HistWinOpen = PgUp

HistWinOpen = PgDn

ScrollUp = Ctrl-Up

ScrollDown = Ctrl-Down

ScrollPgUp = Ctrl-PgUp

ScrollPgDn = Ctrl-PgDn


TabStops
TabStops = nnnn (8):  Sets the tab stops for Take Command's output (including the output from the LIST and TYPE commands).  The allowable range is 1 to 32.


ToolBarOn
ToolBarOn = YES | No:  Yes enables the tool bar when Take Command starts.  No disables it.  The tool bar can always be enabled or disabled while Take Command is running by using the Settings menu.


ToolBarText
ToolBarText = nnnn (8):  Sets the point size of text on the tool bar.  The allowable range is 4 to 16.


UpperCase
 UpperCase = Yes | NO:  Yes specifies that filenames should be displayed in the traditional upper-case by internal commands like COPY and DIR.  No allows the normal Take Command lower-case style.  Also see SETDOS /U.


Color Directives

These directives control the colors that Take Command use for its displays.  For complete details on color names and numbers, see Colors and Color Names.  The color directives are:

ColorDir	Directory colors

InputColors	Input colors

ListColors	Colors used in the LIST display

SelectColors	Colors used in the SELECT display

StdColors	Standard display colors


ColorDIR (directive)
ColorDir = ext1 ext2 ...:colora;ext3 ext4 ... :colorb; ...: Sets the directory colors used by DIR and SELECT.  The format is the same as that used for the COLORDIR environment variable.  See Color-Coded Directories for a detailed explanation.


InputColors
InputColors = Color:  Sets the colors used for command-line input.  This setting is useful for making your input stand out from the normal output.


ListColors
ListColors = Color:  Sets the colors used by the LIST command.  If this directive is not used, LIST will use the current default colors set by the CLS or COLOR command or by the StdColors directive.


SelectColors
SelectColors = Color:  Sets the colors used by the SELECT command.  If this directive is not used, SELECT will use the current default colors set by the CLS or COLOR command or by the StdColors directivel.


StdColors
StdColors = Color:  Sets the standard colors to be used when CLS is used without a color specification.  Using this directive is similar to placing a COLOR command in the TCSTART file.


Key Mapping Directives

These directives allow you to change the keys used for command-line editing and other internal functions.  They cannot be entered via the configuration dialogs; you must enter them manually (see TCMD.INI for details).

They are divided into four types, depending on the context in which the keys are used.  For a discussion and list of directives for each type see:

General Input Keys

Command-Line Editing Keys

History and @SELECT Window Keys

LIST Keys

Scrollback Buffer Keys

Using a key mapping directive allows you to assign a different or additional key to perform the function described.  For example, to use function key F3 to invoke the HELP facility (normally invoked with F1):

Help = F3

Any directive can be used multiple times to assign multiple keys to the same function.  For example:

ListFind = F            ;F does a find in LIST

ListFind = F4           ;F4 also does a find in LIST

Use some care when you reassign keystrokes.  If you assign a default key to a different function, it will no longer be available for its original use.  For example, if you assign F1 to the AddFile directive (a part of filename completion), the F1 key will no longer invoke the help system, so you will probably want to assign a different key to Help.

See Keys and Key Names before using the key mapping directives.

Key assignments are processed before looking for keystroke aliases.  For example, if you assign Shift-F1 to HELP and also assign Shift-F1 to a key alias, the key alias will be ignored.

Assigning a new keystroke for a function does not deassign the default keystroke for the same function.  If you want to deassign one of the default keys, use the NormalKey directive described below or the corresponding directive for keys in the other key groups (NormalEditKey, NormalHWinKey, or NormalListKey).


General Input Keys

These directives apply to all input.  They are in effect whenever Take Command requests input from the keyboard, including during command-line editing and the DESCRIBE, ESET, INPUT, LIST, and SELECT commands.  The general input keys are:

Backspace	Deletes the character to the left of the cursor

BeginLine	Moves the cursor to the start of the line

Del	Deletes the character at the cursor

DelToBeginning	Deletes from the cursor to the start of the line

DelToEnd	Deletes from the cursor to the end of the line

DelWordLeft	Deletes the word to the left of the cursor

DelWordRight	Deletes the word to the right of the cursor

Down	Moves the cursor or scrolls the display down

EndLine	Moves the cursor to the end of the line

EraseLine	Deletes the entire line

ExecLine	Executes or accepts a line

Ins	Toggles insert / overstrike mode

Left	Moves the cursor or scrolls the display left

NormalKey	Deassigns a key

Right	Moves the cursor or scrolls the display right

Up	Moves the cursor or scrolls the display up

WordLeft	Moves the cursor left one word

WordRight	Moves the cursor right one word


Backspace
Backspace = Key (Bksp):  Deletes the character to the left of the cursor.


BeginLine
BeginLine = Key (Home):  Moves the cursor to the beginning of the line.


Del (directive)
Del = Key (Del):  Deletes the character at the cursor.


DelToBeginning
DelToBeginning = Key (Ctrl-Home):  Deletes from the cursor to the start of the line.


DelToEnd
DelToEnd = Key (Ctrl-End):  Deletes from the cursor to the end of the line.


DelWordLeft
DelWordLeft = Key (Ctrl-L):  Deletes the word to the left of the cursor.


DelWordRight
DelWordRight = Key (Ctrl-R, Ctrl-Bksp):  Deletes the word to the right of the cursor.  See ClearKeyMap if you need to remove the default mapping of Ctrl-Bksp to this function.


Down
Down = Key (Down):  Scrolls the display down one line in LIST; moves the cursor down one line in SELECT and in the command-line history, directory history, or %@SELECT window.  (Scrolling down through the command history at the prompt is controlled by NextHistory, not by this directive.)


EndLine
EndLine = Key (End):  Moves the cursor to the end of the line.


EraseLine
EraseLine = Key (Esc):  Deletes the entire line.


ExecLine
ExecLine = Key (Enter):  Executes or accepts a line.


Ins
Ins = Key (Ins):  Toggles insert / overstrike mode during line editing.


Left
Left = Key (Left):  Moves the cursor left one character; scrolls the display left 8 columns in LIST;  scrolls the display left 4 columns in the command-line, directory history, or %@SELECT window.


NormalKey
NormalKey = Key:  Deassigns a general input key in order to disable the usual meaning of the key within Take Command and/or make it available for keystroke aliases.  This will make the keystroke operate as a "normal" key with no special function.  For example:

NormalKey = Ctrl-End

will disable Ctrl-End, which is the standard "delete to end of line" key.  Ctrl-End could then be assigned to a keystroke alias. Another key could be assigned the "delete to end of line" function with the DelToEnd directive.


Right
Right = Key (Right):  Moves the cursor right one character; scrolls the display right 8 columns in LIST; scrolls the display right 4 columns in the command-line history, directory history, or %@SELECT window.


Up
Up = Key (Up):  Scrolls the display up one line in LIST; moves the cursor up one line in SELECT and in the command-line history, directory history, or %@SELECT window.  (Scrolling up through the command history at the prompt is controlled by PrevHistory, not by this directive.)


WordLeft
WordLeft = Key (Ctrl-Left):  Moves the cursor left one word; scrolls the display left 40 columns in LIST.


WordRight
WordRight = Key (Ctrl-Right):  Moves the cursor right one word; scrolls the display right 40 columns in LIST.


Command-Line Editing Keys

These directives apply only to command-line editing.  They are only effective at the Take Command prompt.  The command-line editing keys are:

AddFile	Keeps filename completion entry and adds another

CommandEscape	Allows direct entry of a keystroke

DelHistory	Deletes a history list entry

EndHistory	Displays the last entry in the history list

Help	Invokes this help system

NextFile	Gets the next matching filename

NextHistory	Recalls the next command from the history

NormalEditKey	Deassigns a command-line editing key

PopFile	Opens the filename completion window

PrevFile	Gets the previous matching filename

PrevHistory	Recalls the previous command from the history

SaveHistory	Saves the command line without executing it


AddFile
AddFile = Key (Ctrl-Shift-Tab):  Keeps the current filename completion entry and inserts the next matching name.


CommandEscape
CommandEscape = Key (Alt-255):  Allows direct entry of a keystroke that would normally be interpreted as an editor command.


DelHistory
DelHistory = Key (Ctrl-D):  Deletes the displayed history list entry and displays the previous entry.


EndHistory
EndHistory = Key (Ctrl-E):  Displays the last entry in the history list.


Help
Help = Key (F1):  Invokes the HELP facility.


NextFile
NextFile = Key (F9, Tab):  Gets the next matching filename. See ClearKeyMap if you need to remove the default mapping of Tab to this function.


NextHistory
NextHistory = Key (Ctrl-Down):  Recalls the next command from the command history.  Also see Scrolling and History Keystrokes and the SwapScrollKeys directive.


NormalEditKey
NormalEditKey = Key:  Deassigns a command-line editing key in order to disable the usual meaning of the key while editing a command line, and/or make it available for keystroke aliases.  For additional details see NormalKey.


PopFile
PopFile = Key (F7, Ctrl-Tab):  Opens the filename completion window.  You may not be able to use Ctrl-Tab, because not all systems recognize it as a keystroke.  See ClearKeyMap if you need to remove the default mapping of Ctrl-Tab to this function.


PrevFile
PrevFile = Key (F8, Shift-Tab):  Gets the previous matching filename.  See ClearKeyMap if you need to remove the default mapping of Shift-Tab to this function.


PrevHistory
PrevHistory = Key (Ctrl-Up):  Recalls the previous command from the command history.  Also see Scrolling and History Keystrokes and the SwapScrollKeys directive.


SaveHistory
SaveHistory = Key (Ctrl-K):  Saves the command line in the command history list without executing it.


History and @SELECT Window Keys

These directives apply only to the command history window, the directory history window, and %@SELECT windows.  The History and @SELECT window keys are:

DirWinOpen	Opens the directory history window

HistWinBegin	Moves to the first line of the history window

HistWinDel	Deletes a line from within the history window

HistWinEdit	Moves a line from the history window to the prompt

HistWinEnd	Moves to the last line of the history window

HistWinExec	Executes the selected line in the history window

HistWinOpen	Opens the command history window

NormalHWinKey	Deassigns a history window key


DirWinOpen
DirWinOpen = Key (F6):  Opens the directory history window while at the command line.  Also see Scrolling and History Keystrokes.


HistWinBegin
HistWinBegin = Key (Ctrl-PgUp):  Moves to the first line of the history when in the history window.


HistWinDel
HistWinDel = Key (Ctrl-D):  Deletes a line from within the history window.


HistWinEdit
HistWinEdit = Key (Ctrl-Enter):  Moves a line from the history window to the prompt for editing.


HistWinEnd
HistWinEnd = Key (Ctrl-PgDn):  Moves to the last line of the history when in the history window.


HistWinExec
HistWinExec = Key (Enter):  Executes the selected line in the history window.


HistWinOpen
HistWinOpen = Key (Ctrl-PgUp):  Brings up the history window while at the command line.  Also see Scrolling and History Keystrokes and the SwapScrollKeys directive.


NormalHWinKey
NormalHWinKey = Key:  Deassigns a history window key in order to disable the usual meaning of the key within the history window. For additional details see NormalKey.


LIST Keys

These directives are effective only inside the LIST command.  The LIST keys are:

ListExit	Exits the current file

ListFind	Prompts and searches for a string

ListHex	Toggles hexadecimal display mode

ListHighBit	Toggles LIST's "strip high bit" option

ListInfo	Displays information about the current file

ListNext	Finds the next matching string

ListPrint	Prints the file on LPT1

ListWrap	Toggles LIST's wrap option

NormalListKey	Deassigns a LIST key


ListExit
ListExit = Key (Esc):  Exits the current file.


ListFind
ListFind = Key (F):  Prompts and searches for a string.


ListHex
ListHex = Key (X):  Toggles hexadecimal display mode.


ListHighBit
ListHighBit = Key (H):  Toggles LIST's "strip high bit" option, which can aid in displaying files from certain word processors.


ListInfo
ListInfo = Key (I):  Displays information about the current file.


ListNext
ListNext = Key (N):  Finds the next matching string.


ListPrint
ListPrint = Key (P):  Prints the file on LPT1.


ListWrap
ListWrap = Key (W):  Toggles LIST's wrap option on and off. The wrap option wraps text at the right margin.


NormalListKey
NormalListKey = Key:  Deassigns a LIST key in order to disable the usual meaning of the key within LIST.  For additional details see NormalKey.


Scrollback Buffer Keys

These directives control the keys used to manipulate the scrollback buffer.  For additional information see Scrolling and History Keystrokes and the SwapScrollKeys directive.

ScrollUp	Scroll the buffer up one line.

ScrollDown	Scroll the buffer down one line.

ScrollPgUp	Scroll the buffer up one page.

ScrollPgDn	Scroll the buffer down one page.


ScrollUp
ScrollUp = Key:  Scrolls the Take Command scrollback buffer up one line.


ScrollDown
ScrollDown = Key:  Scrolls the Take Command scrollback buffer down one line.


ScrollPageUp
ScrollPgUp = Key:  Scrolls the Take Command scrollback buffer up one page.


ScrollPageDown
ScrollPgDn = Key:  Scrolls the Take Command scrollback buffer down one page.


Advanced Directives

These directives are generally used for unusual circumstances, or for diagnosing problems.  Most often they are not needed in normal use.  They cannot be entered via the configuration dialogs; you must enter them manually (see TCMD.INI for details).

The only advanced directive available at this time is:

ClearKeyMap	Clear default key mappings


ClearKeyMap
ClearKeyMap:  Clears all current key mappings. ClearKeyMap is a special directive which has no value or "=" after it.  Use ClearKeyMap to make one of the keys in the default map (Tab, Shift-Tab, Ctrl-Tab, or Ctrl-Bksp) available for a keystroke alias.  ClearKeyMap should appear before any other key mapping directives.  If you want to clear some but not all of the default mappings, use ClearKeyMap, then recreate the mappings you want to retain (e.g., with "NextFile=Tab", etc.).


File Associations and Executable Extensions
Windows File Associations

Take Command's Executable Extensions and Windows' File Associations serve the same purpose: they connect applications wth their data files by using the files' extensions.  Take Command recognizes the file associations you have defined in Windows and treats those associations as executable extensions.

When Take Command loads, it reads the list of file extensions that have been previously defined in Windows.  It then adds the executable extensions you have defined with the SET command to the list.  If there are any conflicts, Take Command gives executable extensions precedence over the file associations defined in Windows.  Take Command makes no distinction, however, between executable extensions defined before Windows starts and those defined in the current Take Command session (for example, you may have defined executable extensions for 4DOS if it is your DOS command processor).

To disable a Windows file association within Take Command, use the UNSET command, with a period before the extension, for example:

c:\> unset .ini

This will not remove the file association from Windows, it will only disable it within the current Take Command session.


Take Command and Windows Shells

Take Command can run either as a Windows application, or as a Windows shell (the program that Windows loads initially, and which closes Windows when you close it).

When you run Take Command as a Windows application, it normally communicates with the shell program to build the lists of groups that are displayed in Take Command's Apps menu.  You can set Take Command's method of communication with the ProgmanDDE directive in the Take Command INI file.  In most cases the default ProgManDDE setting of "Auto" will work.  However you may need to set ProgManDDE if you have a non-standard Windows shell.  See the description of ProgManDDE for details.

To install Take Command as the shell, first copy the TC16DLL.DLL file in your Take Command directory to your \WINDOWS\SYSTEM directory (otherwise Windows will not be able to find this file at startup).

Next use SysEdit, Notepad, or another ASCII file editor to edit the SYSTEM.INI file (in your \WINDOWS directory).  In the [Boot] section of SYSTEM.INI find the SHELL= line.  Add a semicolon at the start of the old line to turn it into a comment (this preserves the old setting if you want to return to it in the future).  Then add the following new SHELL= line:

shell=d:\path\tcmd.exe

Substitute the drive and path of TCMD.EXE on your system for "d:\path\" in the line above.  You can add any Take Command startup options to the shell line.  Save SYSTEM.INI, close your editor, and then restart Windows for the line to take effect.

When Take Command is loaded as the Windows shell, it begins by reading the "Load=..." and "Run=..." lines in the [Windows] section of your WIN.INI file.  Take Command starts each application listed on the "Run=" line and starts each application listed in the "Load=" line as an icon.  After these items are processed, Take Command then starts any applications in your Program Manager "Startup" group (using the STARTUP.GRP file).

When you run Take Command as the Windows shell, it assumes that Program Manager or the equivalent has not been loaded.  Therefore, Take Command will not try to establish a DDE connection with Program Manager, regardless of the setting of ProgmanDDE.  Instead, Take Command will search for .GRP files and read them directly in order to build its Apps and Windows menus.  If Take Command is the Windows shell, and you install a new Windows application that tries to create a Program Manager group for its own files, Take Command will start Program Manager in an invisible window and let it create the group.

When Take Command is the Windows shell, it will display a standard Exit Windows dialog box when you close it by issuing an Exit command, by selecting Exit from Take Command's File menu, or by pressing Alt-F4 when Take Command has the focus.


Using Drag and Drop

Take Command is compatible with Windows' Drag-and-Drop facility.

To add a filename to the command line using drag and drop simply drag the file from another application using the mouse, and release the mouse button with the file icon anywhere inside the Take Command window.  The full name of the file will be pasted onto the command line at the current cursor position.

Take Command is a drag and drop "client", which means it can accept files dragged in from other applications and paste their names onto the command line.  It is not a drag and drop "server", so you cannot drag filenames from the Take Command window into other applications.  However you can copy filenames and other text from the Take Command screen to other applications using the clipboard; see Highlighting and Copying Text for details.


DDE

Take Command can communicate with other Windows applications by using Dynamic Data Exchange or DDE.  To use Take Command as a "DDE client" and send a message from Take Command to another application, use the DDEEXEC command.

You can also use Take Command as a "DDE server" and send commands to it from another application.  To do so, use an application or server name of "TCMD" and a topic name of "Execute".  The message can be any valid command that you could enter on the Command line: any alias, internal command, batch file, or external command.  To send more than one line in a single DDE string, separate the lines with carriage return and line feed characters.

For example, you could use the following command to send a message to Take Command itself and execute a DIR /W command (this serves no useful purpose, except to illustrate how to use Take Command as a DDE server):

ddeexec TCMD, Execute, dir /w

If you use Microsoft Word for Windows, the following WordBasic fragment would send the same DDE message to Take Command from within Word:

TCMDChannel = DDEInitiate("TCMD", "Execute")

DDEExecute TCMDChannel, "dir /w"

DDETerminate TCMDChannel

You could use the same approach to execute a batch file or any other Take Command command from within Word, and similar approaches are available in other applications which offer DDE support.  Consult your application manual for complete details.

In most cases when you use Take Command as a DDE server you will want to redirect output from the commands you execute, because output on the Take Command screen is not likely to be useful to the client program which invokes a command.


Commands By Name

?	LIST

ACTIVATE	LOADBTM

ALIAS	LOG

ATTRIB	MD

BEEP	MEMORY

CALL	MOVE

CANCEL	MSGBOX

CD	ON

CDD	PATH

CLS	PAUSE

COLOR	POPD

COPY	PROMPT

DATE	PUSHD

DDEEXEC	QUERYBOX

DEL	QUIT

DELAY	RD

DESCRIBE	REBOOT

DIR	REM

DIRS	REN

DO	RETURN

DRAWBOX	SCREEN

DRAWHLINE	SCRPUT

DRAWVLINE	SELECT

ECHO	SET

ECHOS	SETDOS

ENDLOCAL	SETLOCAL

ESET	SHIFT

EXCEPT	START

EXIT	TEE

FFIND	TEXT

FOR	TIME

FREE	TIMER

GLOBAL	TITLE

GOSUB	TYPE

GOTO	UNALIAS

HELP	UNSET

HISTORY	VER

IF	VERIFY

IFF	VOL

INKEY	VSCRPUT

INPUT	WINDOW

KEYBD	Y

KEYSTACK


Commands By Category

The best way to learn about commands is to experiment with them.  The lists below categorize the available commands by topic and will help you find the ones that you need.

System configuration:

CLS	COLOR	DATE	FREE

HISTORY	KEYBD	LOG	MEMORY

PROMPT	REBOOT	SETDOS	TIME

VER	VERIFY	VOL

File and directory management:

ATTRIB	COPY	DEL	DESCRIBE

FFIND	LIST	MOVE	REN

SELECT	TYPE

Subdirectory management:

CD	CDD	DIR	DIRS

MD	POPD	PUSHD	RD

Input and output:

DRAWBOX	DRAWHLINE	DRAWVLINE	ECHO

ECHOS	INKEY	INPUT	SCREEN

SCRPUT	TEXT	VSCRPUT

Commands primarily for use in or with batch files and aliases (some work only in batch files; see the individual commands for details):

ALIAS	BEEP	CALL	CANCEL

DELAY	DO	ENDLOCAL	FOR

GLOBAL	GOSUB	GOTO	IF

IFF	KEYSTACK	LOADBTM	MSGBOX

ON	PAUSE	QUERYBOX	QUIT

REM	RETURN	SETLOCAL	SHIFT

UNALIAS

Environment and path commands:

ESET	PATH	SET	UNSET

Other commands:

?	ACTIVATE	DDEEXEC	EXCEPT

EXIT	HELP	START	TEE

TIMER	TITLE	WINDOW	Y


?

Purpose:	Display a list of internal commands or prompt for a command.

Format:	? ["prompt text" command]

Usage

? by itself displays a list of internal commands.

If you have disabled a command with SETDOS /I, it will not appear in the list.

If you add prompt text and a command, ? will display the prompt followed by "(Y/N)?" and wait for the user's response.  If the user presses "Y" or "y", the command will be executed.  If the user presses "N" or "n", the command will be ignored.

c:\> ? Load the network call netstart.btm


ACTIVATE

Purpose:	Activate a window, set its state, or change its title.

Format:	ACTIVATE "window" [MAX | MIN | RESTORE | CLOSE | "title"]

window:  Current title of window to work with.

title: New title for window.

See also:  START, TITLE, and WINDOW.

Usage

Both the current name of the window and the new name, if any, must be enclosed in double quotes.  The quotes will not appear as part of the title bar text.

If no options are used, the window named in the command will become the active window and be able to receive keystrokes and mouse commands.

The MAX option expands the window to its maximum size, the MIN option reduces the window to an icon, and the RESTORE option returns the window to its default size and location on the desktop.  The CLOSE option closes the window and ends the session running in the window.

This example renames and maximizes the window called "Take Command":

c:\> activate "Take Command" max "Take Command is Great!"


ALIAS

Purpose:	Create new command names that execute one or more commands or redefine default options for existing commands; assign commands to keystrokes; load or display the list of defined alias names.

Format:	ALIAS [/P /R file...] [name [=][value ]]

file:  One or more files to read for alias definitions.

name:  Name for an alias, or for the key to execute the alias.

value:  Text to be substituted for the alias name.

/P(ause)	/R(ead file)

See also:  UNALIAS.

Usage

The ALIAS command lets you create new command names or redefine internal commands.  It also lets you assign one or more commands to a single keystroke.  An alias is often used to execute a complex series of commands with a few keystrokes or to create "in memory batch files" that run much faster than disk-based batch files.

For example, if you would rather type D instead of DIR /W, you would use the command:

c:\> alias d = dir /w

Now when you type a single d as a command, it will be translated into a DIR /W command.

If you define aliases for commonly used application programs, you can often remove the directories they're stored in from the PATH. For example, if you use Quattro Pro and had the C:\QPRO directory in your path, you could define the following alias:

c:\> alias qpro = c:\qpro\q.exe

With this alias defined, you can probably remove C:\QPRO from your path.  Quattro Pro will now load much faster than it would if Take Command had to search the PATH for it.  In addition, the PATH can be shorter, which will speed up searches for other programs.

If you apply this technique for each application program, you can often reduce your PATH to just two or three directories containing utility programs, and significantly reduce the time it takes to load most software on your system.  Before removing a directory from the PATH, you will need to define aliases for all the executable programs you commonly use which are stored in that directory.

Aliases are stored in memory, and are not saved automatically when you turn off your computer or end your current session.  See below for information on saving and reloading your aliases.

Multiple Commands and Special Characters in Aliases

An alias can represent more than one command.  For example:

c:\> alias letters = `cd \letters ^ text`

creates a new command called LETTERS.  The command first uses CD to change to a subdirectory called \LETTERS and then runs a program called TEXT.  The caret [^] is the command separator and indicates that the two commands are distinct and should be executed sequentially.

Aliases make extensive use of the command separator, and the parameter character, and may also use the escape character.  These characters differ between Take Command and our products for OS/2 and Windows NT.  In the text and examples below, we use the Take Command characters.  If you want to use the same aliases under different command processors, see 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility.

When you type alias commands at the command line or in a batch file, you must use back quotes [`] around the definition if it contains multiple commands, parameters (discussed below), environment variables, redirection, or piping.  The back quotes prevent premature expansion of these arguments.  You may use back quotes around other definitions, but they are not required. (You do not need back quotes when your aliases are loaded from an ALIAS /R file; see below for details.)  The examples above and below include back quotes only when they are required.

Nested Aliases

Aliases may invoke internal commands, external commands, or other aliases.  (However, an alias may not invoke itself, except in special cases where an IF or IFF command is used to prevent an infinite loop.)  The two aliases below demonstrate alias nesting (one alias invoking another).  The first line defines an alias which runs a program called WP.EXE that is in the E:\WP60\ subdirectory.  The second alias changes directories with the PUSHD command, runs the WP alias, and then returns to the original directory with the POPD command:

c:\> alias wp = e:\wp60\wp.exe

[c:\] alias w = `pushd c:\wp ^ wp ^ popd`

The second alias above could have included the full path and name of the WP.EXE program instead of calling the WP alias. However, writing two aliases makes the second one easier to read and understand, and makes the first alias available for independent use.  If you rename the WP.EXE program or move it to a new directory, only the first alias needs to be changed.

Temporarily Disabling Aliases

If you put an asterisk [*] immediately before a command in the value of an alias definition (the part after the equal sign), it tells Take Command not to attempt to interpret that command as another (nested) alias.  An asterisk used this way must be preceded by a space or the command separator and followed immediately by an internal or external command name.

By using an asterisk, you can redefine the default options for any internal command.  For example, suppose that you always want to use the DIR command with the /2 (two column) and /P (pause at the end of each page) options:

c:\> alias dir = *dir /2/p

If you didn't include the asterisk, the second DIR on the line would be the name of the alias itself, and Take Command would repeatedly re- invoke the DIR alias, rather than running the DIR command.  This would cause an "Alias loop" or "Command line too long" error.

An asterisk also helps you keep the names of internal commands from conflicting with the names of external programs.  For example, suppose you have a program called LIST.COM.  Normally, the internal LIST command will run anytime you type LIST.  But two simple aliases will give you access to both the LIST.COM program and the LIST command:

c:\> alias list = c:\util\list.com

c:\> alias display = *list

The first line above defines LIST as an alias for the LIST.COM program.  If you stopped there, the external program would run every time you typed LIST and you would not have easy access to the internal LIST command.  The second line renames the internal LIST command as DISPLAY.  The asterisk is needed in the second command to indicate that the following word means the internal command LIST, not the LIST alias which runs your external program.

You can also use an asterisk before a command that you enter at the command line or in a batch file.  If you do, that command won't be interpreted as an alias.  This can be useful when you want to be sure you are running the true, original command and not an alias with the same name, or temporarily defeat the purpose of an alias which changes the meaning or behavior of a command.

Partial Alias Names

You can also use an asterisk in the name of an alias.  When you do, the characters following the asterisk are optional when you invoke the alias command.  (Use of an asterisk in the alias name is unrelated to the use of an asterisk in the alias value discussed above.)  For example, with this alias:

c:\> alias wher*eis = dir /sp

the new command, WHEREIS, can be invoked as WHER, WHERE, WHEREI, or WHEREIS.  Now if you type:

c:\> where myfile.txt

The WHEREIS alias will be expanded to the command:

dir /sp myfile.txt

Keystroke Aliases

If you want to assign an alias to a keystroke, use the keyname on the left side of the equal sign, preceded by an at sign [@]. For example, to assign the command DIR /W to the F4 key, type

c:\> alias @F4 = dir /w

See Keys and Key Names for a complete listing of key names and a description of the key name format.  You can not use Alt key names (e.g. Alt-D) for keystroke aliases because these names are used by Windows for "accelerator" (shortcut) keys for menu items.

When you define keystroke aliases, the assignments will only be in effect at the command line, not inside application programs.  Be careful not to assign aliases to keys that are already used at the command line (like F1 for Help).  The command-line meanings take precedence and the keystroke alias will never be invoked.  If you want to use one of the command-line keys for an alias instead of its normal meaning, you must first disable its regular use with the NormalKey or NormalEditKey directive in your .INI file.

If you define a keystroke alias with a single at sign as shown above, then, when you press the F4 key, the value of the alias (DIR /W above) will be placed on the command line for you.  You can type additional parameters if you wish and then press Enter to execute the command.  With this particular alias, you can define the files that you want to display after pressing F4 and before pressing Enter to execute the command.

If you want the keystroke alias to take action automatically without waiting for you to edit the command line or press Enter, you can begin the definition with two at signs [@@]. Take Command will execute the alias "silently," without displaying its text on the command line.  For example, this command will assign an alias to the F6 key that uses the CDD command to take you back to the previous default directory:

c:\> alias @@f6 = cdd -

You can also define a keystroke alias by using "@" or "@@" plus a scan code for one of the permissible keys (see the Key Code Tables for a list of scan codes).  In most cases it will be easier to use key names.  Scan codes should only be used with unusual keyboards where a key name is not available for the key you are using.

Displaying Aliases

If you want to see a list of all current ALIAS commands, type:

c:\> alias

You can also view the definition of a single alias.  If you want to see the definition of the alias LIST, you can type:

c:\> alias list

Saving and Reloading Your Aliases

You can save your aliases to a file called ALIAS.LST this way:

c:\> alias > alias.lst

You can then reload all the alias definitions in the file the next time you boot up with the command:

c:\> alias /r alias.lst

This is much faster than defining each alias individually in a batch file.  If you keep your alias definitions in a separate file which you load when your system starts, you can edit them with a text editor, reload the edited file with ALIAS /R, and know that the same alias list will be loaded the next time you boot your computer.

When you define aliases in a file that will be read with the ALIAS /R command, you do not need back quotes around the value, even if back quotes would normally be required when defining the same alias at the command line or in a batch file.

To remove an alias, use the UNALIAS command.

Alias Parameters

Aliases can use command-line arguments or parameters like those in batch files.  The command-line arguments are numbered from %0 to %127.  %0 contains the alias name.  It is up to the alias to determine the meaning of the other parameters.  You can use quotation marks to pass spaces, tabs, commas, and other special characters in an alias parameter; see Argument Quoting for details.

Parameters that are referred to in an alias, but which are missing on the command line, appear as empty strings inside the alias.  For example, if you put two parameters on the command line, any reference in the alias to %3 or any higher-numbered parameter will be interpreted as an empty string.

The parameter %n& has a special meaning.  Take Command interprets it to mean "the entire command line, from argument n to the end."  If n is not specified, it has a default value of 1, so %& means "the entire command line after the alias name."  The special parameter %# contains the number of command-line arguments.

For example, the following alias will change directories, perform a command, and return to the original directory:

[c:\] alias in `pushd %1 ^ %2$ ^ popd`

When this alias is invoked as:

c:\> in c:\comm mycomm /xmodem /2400

the first parameter, %1, has the value c:\comm.  %2 is mycomm,  3 is /xmodem, and %4 is /2400. The command line expands into these three separate commands:

pushd c:\comm

mycomm /xmodem /2400

popd

This next example uses the IFF command to redefine the defaults for SET.  It should be entered on one line:

c:\> alias set = `iff %# == 0 then ^ *set /p ^ else ^ *set %& ^ endiff`

This modifies the SET command so that if SET is entered with no arguments, it is replaced by SET /P (pause after displaying each page), but if SET is followed by an argument, it behaves normally. Note the use of asterisks (*set) to prevent alias loops.

If an alias uses parameters, command-line arguments will be deleted up to and including the highest referenced argument.  For example, if an alias refers only to %1 and %4, then the first and fourth arguments will be used, the second and third arguments will be discarded, and any additional arguments beyond the fourth will be appended to the expanded command (after the value portion of the alias).  If an alias uses no parameters, all of the command- line arguments will be appended to the expanded command.

Aliases also have full access to all variables in the environment, internal variables, and variable functions.  For example, you can create a simple command-line calculator this way (enter this on one line):

c:\> alias calc = `echo The answer is: %@eval[%&]`

Now, if you enter:

c:\> calc 5 * 6

the alias will display:

The answer is: 30

The UNKNOWN_CMD Alias

If you create an alias with the name UNKNOWN_CMD, it will be executed any time Take Command would normally issue an "Unknown command" error message.  This allows you to define your own handler for unknown commands.  When the UNKNOWN_CMD alias is executed, the command line which generated the error is passed to the alias for possible processing.

Use caution when you create the UNKNOWN_CMD alias.  If the alias contains an unknown command, it will be called repeatedly and Take Command will lock up in an infinite loop.

Options

/P	(Pause) This option is only effective when ALIAS is used to display existing definitions.  It pauses the display after each page and waits for a keystroke before continuing (see Page and File Prompts).

/R	(Read file) This option loads an alias list from a file. The format of the file is the same as that of the ALIAS display:

name=value

where name is the name of the alias and value is its value.  You can use an equal sign [=] or space to separate the name and value.  Back quotes are not required around the value.  You can add comments to the file by starting each comment line with a colon [:].  You can load multiple files with one ALIAS /R command by placing the names on the command line, separated by spaces:

c:\> alias /r alias1.lst alias2.lst

Each definition in an ALIAS /R file can be up to 2047 characters long. The definitions can span multiple lines in the file if each line, except the last, is terminated with an escape character.


ATTRIB

Purpose:	Change or view file and subdirectory attributes.

Format:	ATTRIB [/A[[:][-]rhsda] /D /P /Q /S] [+|-[AHRS]] files ...

files:  A file, directory, or list of files or directories on which to operate.

/A(ttribute select)	/Q(uiet)

/D(irectories)	/S(ubdirectories)

/P(ause)

Attribute flags:

+A	Set the archive attribute

-A	Clear the archive attribute

+H	Set the hidden attribute

-H	Clear the hidden attribute

+R	Set the read-only attribute

-R	Clear the read-only attribute

+S	Set the system attribute

-S	Clear the system attribute

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

Every file and subdirectory has 4 attributes that can be turned on (set) or turned off (cleared):  Archive, Hidden, Read- only, and System.

The ATTRIB command lets you set or clear attributes for any file, group of files, or subdirectory.  You can view file attributes by entering ATTRIB without specifying new attributes (i.e., without the [+|-[AHRS]] part of the format), or with the DIR /T command.

For example, you can set the read-only and hidden attributes for the file MEMO:

c:\> attrib +rh memo

Attribute options apply to the file(s) that follow the options on the ATTRIB command line.  The example below shows how to set different attributes on different files with a single command.  It sets the archive attribute for all .TXT files, then sets the system attribute and clears the archive attribute for TEST.COM:

c:\> attrib +a *.txt +s -a test.com

Your operating system also supports "D" (subdirectory) and "V" (volume label) attributes.  These attributes cannot be altered with ATTRIB; they are designed to be controlled only by the operating system itself.

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., /A), ATTRIB will select all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.

/D	(Directories) If you use the /D option, ATTRIB will modify the attributes of subdirectories in addition to files (yes, you can have a hidden subdirectory):

c:\> attrib /d +h c:\mydir

In addition, the /D option will keep ATTRIB from appending "\*.*" to the end of a directory name and modifying the attributes of all the files in the subdirectory.

If you use a directory name instead of a file name, and omit /D, ATTRIB will append "\*.*" to the end of the name and act on all files in that directory, rather than acting on the directory itself.

/P	(Pause) Wait for a key to be pressed after each screen page before continuing the display.  Your options at the prompt are explained in detail under Page and File Prompts.

/Q	(Quiet) This option turns off ATTRIB's normal screen output. It is most useful in batch files.

/S	(Subdirectories) If you use the /S option, the ATTRIB command will be applied to all matching files in the current or named directory and all of its subdirectories.


BEEP

Purpose:	Beep the speaker or play simple music.

Format:	BEEP [frequency duration ...]

frequency:  The beep frequency in Hertz (cycles per second).

duration:  The beep length in 1/18th second intervals.

Usage

BEEP generates a sound through your computer's speaker.  It is normally used in batch files to signal that an operation has been completed, or that the computer needs attention.

Because BEEP allows you to specify the frequency and duration of the sound, you can also use it to play simple music or to create different kinds of signals for the user.

You can include as many frequency and duration pairs as you wish. No sound will be generated for frequencies less than 20 Hz, allowing you to insert short delays.  The default value for frequency is 440 Hz; the default value for duration is 2.

This batch file fragment runs a program called DEMO, then plays a few notes and waits for you to press a key:

demo

beep 440 4  600 2  1040 6

pause Finished with the demo - hit a key...

The following table gives the frequency values for a five octave range (middle C is 262 Hz):

	C	131	262	523	1046	2093
	C# / Db	139	277	554	1108	2217
	D	147	294	587	1175	2349
	D# / Eb	156	311	622	1244	2489
	E	165	330	659	1318	2637
	F	175	349	698	1397	2794
	F# / Gb	185	370	740	1480	2960
	G	196	392	784	1568	3136
	G# / Ab	208	415	831	1662	3322
	A	220	440	880	1760	3520
	A# / Bb	233	466	932	1866	3729
	B	248	494	988	1973	3951


CALL

Purpose:	Execute one batch file from within another.

Format:	CALL file

file:  The batch file to execute.

See also:  CANCEL and QUIT.

Usage

CALL allows batch files to call other batch files (batch file nesting).  The calling batch file is suspended while the called (second) batch file runs.  When the second batch file finishes, the original batch file resumes execution at the next command.  If you execute a batch file from inside another batch file without using CALL, the first batch file is terminated before the second one starts.

Take Command supports batch file nesting up to ten levels deep.

The current ECHO state is inherited by a called batch file.

A called batch file will return to the calling file after processing the last line in the called file, or when a QUIT command is executed.  A called batch file should always return in this way, or terminate all batch files with CANCEL.  Restarting (or CALLing) the original batch file from within a called file will prevent Take Command from detecting that you've left the second file, and it may cause an infinite loop or a stack overflow.

CALL returns an exit code which matches the batch file return code. You can test this exit code with the %_? or %? environment variable, and use it with conditional commands(&& and ||).


CANCEL

Purpose:	Terminate batch file processing.

Format:	CANCEL [value ]

value:  The exit code from 0 to 255 to return to Take Command.

See also:  CALL and QUIT.

Usage

The CANCEL command ends all batch file processing, regardless of the batch file nesting level.  Use QUIT to end a nested batch file and return to the previous batch file.

You can CANCEL at any point in a batch file.  If CANCEL is used from within an alias it will end execution of both the alias and any batch file(s) which are running at the time.

The following batch file fragment compares an input line to "end" and terminates all batch file processing if it matches:

input Enter your choice:  %%option

if "%option" == "end" cancel

If you specify a value, CANCEL will set the ERRORLEVEL or exit code to that value (see the IF command, and the %? variable).


CD

Purpose:	Display or change the current directory.

Format:	CD [ path | - ]

     or

CHDIR [ path | - ]

path:  The directory to change to, including an optional drive name.

See also:  CDD, MD, PUSHD, RD, and CDPATH.

Usage

CD and CHDIR are synonyms.  You can use either one.

CD lets you navigate through the disk subdirectory structure by changing the current working directory.  If you enter CD and a directory name, the named directory becomes the new current directory.  For example, to change to the subdirectory C:\FINANCE\MYFILES:

c:\> cd \finance\myfiles

c:\finance\myfiles>

Every disk drive on the system has its own current directory. Specifying both a drive and a directory in the CD command will change the current directory on the specified drive, but will not change the default drive.  For example, to change the default directory on drive A:

c:\> cd a:\utility

c:\>

Notice that this command does not change to drive A:.  Use the CDD command to change the current drive and directory at the same time.

You can change to the parent directory with CD ..; you can also go up one additional directory level with each additional [.]. For example, CD .... will go up three levels in the directory tree (see Extended Parent Directory Names).  You can move to a sibling directory -- one that branches from the same parent directory as the current subdirectory -- with a command like CD .\newdir .

If you enter CD with no argument or with only a disk drive name, it will display the current directory on the default or named drive.

CD saves the current directory before changing to a new directory. You can switch back to the previous directory by entering CD -. (There must be a space between the CD command and the hyphen.)  You can switch back and forth between two directories by repeatedly entering CD -.  The saved directory is the same for both the CD and CDD commands.  Drive changes and automatic directory changes also modify the saved directory, so you can use CD - to return to a directory that you exited with an automatic directory change.

Directory changes made with CD are recorded for display in the directory history window.

CD never changes the default drive.  If you change directories on one drive, switch to another drive, and then enter CD -, the directory will be restored on the first drive but the current drive will not be changed.

If CD can't change directly to the specified directory, it will look for the CDPATH variable; see CDPATH for details.


CDD

Purpose:	Change the current disk drive and directory.

Format:	CDD path

path:  The name of the directory (or drive and directory) to change to.

See also:  CD, MD, PUSHD, RD, and CDPATH.

Usage

CDD is similar to the CD command, except that it also changes the default disk drive if one is specified.  CDD will change to the directory and drive you name.  To change from the root directory on drive A to the subdirectory C:\WP:

a:\> cdd c:\wp

You can change to the parent directory with CDD ..; you can also go up one additional directory level with each additional [.].  For example, CDD .... will go up three levels in the directory tree.

CDD saves the current drive and directory before changing to a new directory.  You can switch back to the previous drive and directory by entering CDD -.  (There must be a space between the CDD command and the hyphen.)  You can switch back and forth between two drives and directories by repeatedly entering CDD -.  The saved directory is the same for both the CD and CDD commands.  Drive changes and automatic directory changes also modify the saved directory, so you can use CDD - to return to a directory that you exited with a drive change or an automatic directory change.

Directory changes made with CDD are recorded for display in the directory history window.

If CDD can't change directly to the specified directory, it will look for the CDPATH variable; see CDPATH for details.


CLS

Purpose:	Clear the video display and move the cursor to the upper left corner; optionally change the default display colors.

Format:	CLS [/C] [[BRIght] fg ON [BRIght] bg

/C(lear buffer)

fg:  The new foreground color

bg:  The new background color

Usage

CLS can be used to clear the screen without changing colors, or to clear the screen and change the screen colors simultaneously. These two examples show how to clear the screen to the default colors, and to bright white letters on a blue background:

c:\> cls

c:\> cls bright white on blue

c:\> cls bri yel on mag bor blu

CLS is often used in batch files to clear the screen before displaying text.

See Colors and Color Names for details about colors.

Option

/C	(Clear buffer)  Clears the entire scrollback buffer, not just the visible portion of the Take Command screen.


COLOR

Purpose:	Change the default display colors.

Format:	COLOR [BRIght] fg ON [BRIght] bg

fg:  The new foreground color

bg:  The new background color

See also:  CLS, and Colors and Color Names for details about using colors.

Usage

COLOR is normally used in batch files before displaying text. For example, to set screen colors to bright white on blue, you can use this command:

c:\> color bright white on blue


COPY

Purpose:	Copy data between disks, directories, files, or physical hardware devices (such as your printer or serial port).

Format:	COPY [/A:[[-]rhsda] /C /H /M /N /P /Q /R /S /T /U /V] source [+] ... [/A /B] destination [/A/B]

source:  A file or list of files or a device to copy from.

destination:  A file, directory, or device to copy to.

/A(SCII)	/P(rompt)

/A:  (Attribute select)	/Q(uiet)

/B(inary)	/R(eplace)

/C(hanged)	/S(ubdirectories)

/H(idden)	/T(otals)

/M(odified)	/U(pdate)

/N(othing)	/V(erify)

See also:  ATTRIB, MOVE, and REN.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.  Date, time, or size ranges anywhere on the line apply to all source files.

Usage

The COPY command accepts all traditional syntax and options and adds several new features.

The simplest use of COPY is to make a copy of a file, like this example which makes a copy of a file called FILE1.ABC:

c:\> copy file1.abc file2.def

You can also copy a file to another drive and/or directory.  The following command copies FILE1 to the \MYDIR directory on drive E:

c:\> copy file1 e:\mydir

You can copy several files at once by using wildcards:

c:\> copy *.txt e:\mydir

You can also list several source files in one command.  The following command copies 3 files from the current directory to the \MYDIR directory on drive E:

c:\> copy file1 file2 file3 e:\mydir

The way COPY interprets your command line depends on how many arguments (file, directory, or device names) are on the line, and whether the arguments are separated with [+] signs or spaces.

If there is only one argument on the line, COPY assumes it is the source, and uses the current drive and directory as the destination.  For example, the following command copies all the .DAT files on drive A to the current directory on drive C:

c:\> copy a:*.dat

If there are two or more arguments on the line and [+] signs are not used, then COPY assumes that the last argument is the destination and copies all source files to this new location.  If the destination is a drive, directory, or device name then the source files are copied individually to the new location.  If the destination is a file name, the first source file is copied to the destination, and any additional source files are then appended to the new destination file.

For example, the first of these commands copies the .DAT files from the current directory on drive A individually to C:\MYDIR (which must already exist as a directory); the second appends all the .DAT files together into one large file called C:\DATA (assuming C:\DATA is not a directory):

c:\> copy a:*.dat c:\mydir\

c:\> copy a:*.dat c:\data

When you copy to a directory, if you add a backslash [\] to the end of the name as shown in the first example above, COPY will display an error message if the name does not refer to an existing directory.  You can use this feature to keep COPY from treating a mistyped destination directory name as a file name and attempting to append all your source files to a destination file, when you really meant to copy them individually to a destination directory.

A plus [+] tells COPY to append two or more files to a single destination file.  If you list several source files separated with [+] and don't specify a destination, COPY will use the name of the first source file as the destination, and append each subsequent file to the first file.  In this case the destination file will always be created in the current directory, even if the first source file is in another directory or on another drive.

For example, the following command will append the contents of C:\MEMO2 and C:\MEMO3 to C:\MEMO1 and leave the combined contents in the file named C:\MEMO1:

c:\> copy memo1+memo2+memo3

To append the same three files but store the result in BIGMEMO:

c:\> copy memo1+memo2+memo3 bigmemo

To append C:\MEM\MEMO2 and C:\MEM\MEMO3 to D:\DATA\MEMO1, and leave the result in C:\MEM\MEMO1:

c:\mem> copy d:\data\memo1+memo2+memo3

You cannot append files to a device (such as a printer); if you try to do so, COPY will ignore the [+] signs and copy the files individually.  If you attempt to append several source files to a destination directory or disk, COPY will append the files and place the copy in the new location with the same name as the first source file.

If your destination has wildcards in it, COPY will attempt to match them with the source names.  For example, this command copies the .DAT files from drive A to C:\MYDIR and gives the new copies the extension .DX:

c:\> copy a:*.dat c:\mydir\*.dx

This feature can give you unexpected results if you use it with multiple source file names.  For example, suppose that drive A contains XYZ.DAT and XYZ.TXT.  The command

c:\ copy a:\*.dat a:\*.txt c:\mydir\*.dx

will copy A:XYZ.DAT to C:\MYDIR\XYZ.DX.  Then it will copy A:XYZ.TXT to C:\MYDIR\XYZ.DX, overwriting the first file it copied.

COPY also understands include lists, so you can specify several different kinds of files in the same command.  This command copies the .TXT, .DOC, and .BAT files from the E:\MYDIR directory to the root directory of drive A:

c:\> copy e:\mydir\*.txt;*.doc;*.bat a:\

You can use date, time, and size ranges to further define the files that you want to copy.  This example copies every file in the E:\MYDIR directory, which was created or modified yesterday, and which is also 10,000 bytes or smaller in size, to the root directory of drive A:

c:\> copy /[d-1] /[s0,10000] e:\mydir\*.* a:\

COPY maintains the hidden and system attributes of files, but not the read-only attribute.  The destination file will always have the archive attribute set.

Options

The /A(SCII) and /B(inary) options apply to the preceding filename and to all subsequent filenames on the command line until the file name preceding the next /A or /B, if any.  The other options (/A:, /C, /H, /M, /N, /P, /Q, /R, /S, /T, /U, /V) apply to all filenames on the command line, no matter where you put them.  For example, either of the following commands could be used to copy a font file to the printer in binary mode:

c:\> copy /b myfont.dat prn

c:\> copy myfont.dat /b prn

Some options do not make sense in certain contexts, in which case COPY will ignore them.  For example, you cannot prompt before replacing an existing file when the destination is a device such as the printer -- there's no such thing as an "existing file" on the printer.  If you use conflicting output options, like /Q and /P, COPY will take a "conservative" approach and give priority to the option which generates more prompts or more information.

/A	(ASCII) If you use /A with a source filename, the file will be copied up to, but not including, the first Ctrl-Z (Control-Z or ASCII 26) character in the file.  If you use /A with a destination filename, a Ctrl-Z will be added to the end of the file (some application programs use the Ctrl-Z to mark the end of a file).  /A is the default when appending files, or when the destination is a device like NUL or PRN, rather than a disk file.

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., COPY /A:), COPY will select all files and subdirectories including hidden and system files (this is equivalent to COPY /H).  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.

/B	(Binary) If you use /B with a source filename, the entire file is copied; Ctrl-Z characters in the file do not affect the copy operation.  Using /B with a destination filename prevents addition of a Ctrl-Z to the end of the destination file. /B is the default for normal file copies.

/C	(Changed files) Copy files only if the destination file exists and is older than the source (see also /U).  This option is useful for updating the files in one directory from those in another without copying any newly created files.

/H	(Hidden) Copy all matching files including those with the hidden and/or system attribute set.

/M	(Modified) Copy only those files with the archive attribute set, i.e., those which have been modified since the last backup.  The archive attribute will not be cleared after copying.

/N	(Nothing) Do everything except actually perform the copy. This option is useful for testing what the result of a complex COPY command will be.

/P	(Prompt) Ask the user to confirm each source file.  Your options at the prompt are explained in detail under Page and File Prompts.

/Q	(Quiet) Don't display filenames or the total number of files copied.  This option is most often used in batch files.  See also /T.

/R	(Replace) Prompt the user before overwriting an existing file.   Your options at the prompt are explained in detail under Page and File Prompts.

/S	(Subdirectories) Copy the subdirectory tree starting with the files in the source directory plus each subdirectory below that.  The destination must be a directory; if it doesn't exist, COPY will attempt to create it.  COPY will also attempt to create needed subdirectories on the tree below the destination, including empty source directories.  If you attempt to use COPY /S to copy a subdirectory tree into part of itself, COPY will display an error message and exit.

/T	(Totals) Turns off  the display of filenames, like /Q, but does display the total number of files copied.

/U	(Update) Copy each source file only if it is newer than a matching destination file or if a matching destination file does not exist (see also /C).  This option is useful for keeping one directory matched with another with a minimum of copying.

/V	(Verify) Verify each disk write.  This is the same as executing the VERIFY ON command, but is only active during the COPY.  /V does not read back the file and compare its contents with what was written; it only verifies that the data written to disk is physically readable.


DATE

Purpose:	Display and optionally change the system date.

Format:	DATE [mm -dd -yy ]

mm:  The month (1 - 12).

dd:  The day (1 - 31).

yy:  The year (80 - 99 = 1980 - 1999, or a 4- digit year).

See also:  TIME.

Usage

If you simply type DATE without any parameters, you will see the current system date and time, and be prompted for a new date. Press ENTER if you don't wish to change the date.  If you type a new date, it will become the current system date, which is included in the directory entry for each file as it is created or altered:

c:\> date

Thu  Dec 22, 1994  9:30:06

Enter new date (mm-dd-yy):

You can also enter a new system date by typing the DATE command plus the new date on the command line:

c:\> date 3-16-95

You can use hyphens, slashes, or periods to separate the month, day, and year entries.  A full 4-digit year can be entered if you wish.

DATE adjusts the format it expects depending on your country settings.  When entering the date, use the correct format for the country setting currently in effect on your system.


DDEEXEC

Purpose:	Send a DDE command to another application.

Format:	DDEEXEC server, topic, command

server:  The DDE name of the program that will receive the command.

topic:  The server's topic name for receiving the command.

command:  The command string to send to the server.

Usage

Windows supports a form of communication between programs called Dynamic Data Exchange or DDE.  Using DDE, one program can send a command or data to another.  The receiving program is usually called the DDE server; the sending program is usually called the DDE client.  When you use DDEEXEC, Take Command acts as a DDE client and the program which receives the command is the server.  (Take Command can also act as a DDE server.  See the DDE topic for details.)

For example, if you want to instruct the Program Manager to display its Main group, you can use this command:

c:\> ddeexec progman, progman, [ShowGroup(Main,1)]

In this example, the server name and the topic name are both progman and the command is [ShowGroup(Main,1)]

The server name, topic name, and possible commands are defined by the server application.  See the documentation included with the programs to which you want to send DDE messages for details about the names and commands to use.


DEL

Purpose:	Erase one file, a group of files, or entire subdirectories.

Format:	DEL [/A[[:][-]rhsda] /N /P /Q /S /T /X /Y /Z] file...

    or

ERASE [/A[[:][-]rhsda] /N /P /Q /S /T /X /Y /Z] file...

file:  The file, subdirectory, or list of files or subdirectories to erase.

/A(ttribute select)	/T(otal)

/N(othing)	/X (remove empty subdirectories)

/P(rompt)	/Y(es to all prompts)

/Q(uiet)	/Z(ap hidden and read-only files)

/S(ubdirectories)

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

DEL and ERASE are synonyms, you can use either one.

Use the DEL and ERASE commands with caution; the files and subdirectories that you erase may be impossible to recover without specialized utilities and a lot of work.

To erase a single file, simply enter the file name:

c:\> del letters.txt

You can also erase multiple files in a single command.  For example, to erase all the files in the current directory with a .BAK or .PRN extension:

c:\> del *.bak *.prn

If you enter a subdirectory name, or a filename composed only of wildcards (* and/or ?), DEL asks for confirmation (Y or N) unless you specified the /Y option.  If you respond with a Y, DEL will delete all the files in that subdirectory (hidden, system, and read-only files are only deleted if you use the /Z option).

DEL displays the amount of disk space recovered, unless the /Q option is used (see below).  It does so by comparing the amount of free disk space before and after the DEL command is executed.  This amount may be incorrect if you are using a deletion tracking system which stores deleted files in a hidden directory, or if, under a multitasking system, another program performs a file operation while the DEL command is executing.

Remember that DEL removes file descriptions along with files.  Most deletion tracking systems will not be able to save or recover a file's description, even if they can save or recover the data in a file.

DEL returns a non-zero exit code if no files are deleted, or if another error occurs.  You can test this exit code with the %_? environment variable, and use it with conditional commands (&& and ||).

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., DEL /A), DEL will delete all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected for deletion.  For example, /A:RHS will select only those files with all three attributes set.

/N	(Nothing) Do everything except actually delete the file(s).  This is useful for testing what the result of a DEL would be.

/P	(Prompt) Prompt the user to confirm each erasure.  Your options at the prompt are explained in detail under Page and File Prompts.

/Q	(Quiet) Don't display filenames as they are deleted, or the number of files deleted or bytes freed.  See also /T.

/S	(Subdirectories) Delete the specified files in this directory and all of its subdirectories.  This is like a GLOBAL DEL, and can be used to delete all the files in a subdirectory tree or even a whole disk.  It should be used with caution!

/T	(Total) Don't display filenames as they are deleted, but display the total number of files deleted plus the amount of free disk space recovered.  Unlike /Q, the /T option will not speed up deletions under DOS.

/X	(Remove empty subdirectories) Remove empty subdirectories after deleting (only useful when used with /S).

/Y	(Yes) The reverse of /P -- it assumes a Y response to everything, including deleting an entire subdirectory tree.  Take Command normally prompts before deleting files when the name consists only of wildcards or a subdirectory name (see above); /Y overrides this protection, and should be used with extreme caution!

/Z	(Zap) Delete read-only, hidden, and system files as well as normal files.  Files with the read-only, hidden, or system attribute set are normally protected from deletion; /Z overrides this protection, and should be used with caution.  Because EXCEPT works by hiding files, /Z will override an EXCEPT command.

For example, to delete the entire subdirectory tree starting with C:\UTIL, including hidden and read- only files, without prompting (use this command with CAUTION!):

c:\> del /sxyz c:\util\


DELAY

Purpose:	Pause for a specified length of time.

Format:	DELAY [seconds]

seconds:  The number of seconds to delay.

Usage

DELAY is useful in batch file loops while waiting for something to occur.  To wait for 10 seconds:

delay 10

A simple loop could make a tone with the BEEP command to get the operator's attention and then DELAY for a few seconds while waiting for the user to respond.

For delays shorter than one second, use the BEEP command with an inaudible frequency (below 20 Hz).

You can cancel a delay by pressing Ctrl-C or Ctrl-Break.


DESCRIBE

Purpose:	Create, modify, or delete file and subdirectory descriptions.

Format:	DESCRIBE [/A[[:][-]rhsda]] file ["description" ] ...

file:  The file or files to operate on.

"description":  The description to attach to the file.

/A(ttribute select)

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

DESCRIBE adds descriptions to files and subdirectories.  The descriptions are displayed by DIR in single-column mode and by SELECT.  Descriptions let you identify your files in much more meaningful ways than you can in an eight-character filename.

You enter a description on the command line by typing the DESCRIBE command, the filename, and the description in quotation marks, like this:

c:\> describe memo.txt "Memo to Bob about party"

If you don't put a description on the command line, DESCRIBE will prompt you for it:

c:\> describe memo.txt

Describe "memo.txt" : Memo to Bob about party

If you use wildcards or multiple filenames with the DESCRIBE command and don't include the description text, you will be prompted to enter a description for each file.  If you do include the description on the command line, all matching files will be given the same description.

Each description can be up to 40 characters long.  You can change this limit with the DescriptionMax directive in TCMD.INI.  DESCRIBE can edit descriptions longer than DescriptionMax (up to a limit of 200 characters), but will not allow you to lengthen the existing text.

The descriptions are stored in each directory in a hidden file called DESCRIPT.ION.  Use the ATTRIB command to remove the hidden attribute from this file if you need to copy or delete it.  (DESCRIPT.ION is always created as a hidden file, but will not be re-hidden by Take Command if you remove the hidden attribute.)  You can change the description file name with the DescriptionName directive in the 4NT.INI file or the SETDOS /D command, and retrieve it with the _DNAME internal variable.

The description file is modified appropriately whenever you perform an internal command which affects it (such as COPY, MOVE, DEL, or RENAME), but not if you use an external program (such as XCOPY or a visual shell).

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., /A), DESCRIBE will select all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.


DIR

Purpose:	Display information about files and subdirectories.

Format:	DIR [/1 /2 /4 /A[[:][-]rhsda] /B /C[HP] /D /E /F /H /I"text" /J /K /L /M /N /O[[:][]acdeginrsu] /P /R /S /T /U /V /W /X /Z] [file...]

file:  The file, directory, or list of files or directories to display.

/1 (one column)	/L(ower case)

/2 (two columns)	/M (suppress footer)

/4 (four columns)	/N(ormal)

/A(ttribute select)	/O(rder)

/B(are)	/P(ause)

/C(ompression)	/R (disable wRap)

/D(isable color coding)	/S(ubdirectories)

/E (use upper case)	/T (aTtribute)

/F(ull path)	/U (sUmmary information)

/H(ide dots)	/V(ertical sort)

/I (match descriptions)	/W(ide)

/J(ustify names)	/X (display short names)

/K (suppress header)	/Z (use FAT format)

See also:  ATTRIB, DESCRIBE, SELECT, and SETDOS.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

DIR can be used to display information about files from one or more of your disk directories, in a wide range of formats.  Depending on the options chosen, you can display the file name, attributes, and size; the time and date of the last change to the file; the file description; and the file's compression ratio.  You can also display information in 1, 2, 4, or 5 columns, sort the files several different ways, use color to distinguish file types, and pause after each full screen.

The various DIR displays are controlled through options or switches.  The best way to learn how to use the many options available with the DIR command is to experiment.  You will soon know which options you want to use regularly.  You can select those options permanently by using the ALIAS command.

You may want to mix several options.  For example, to display all the files in the current directory, in 2 columns, sorted vertically (down one column then down the next), and with a pause at the end of each page:

c:\> dir /2/p/v

To set up this format as the default, using an alias:

c:\> alias dir=*dir /2/p/v

This example displays all the files on all directories of drive C, including hidden and system files, pausing after each page:

c:\> dir /s/a/p c:\

DIR allows wildcard characters (* and ?) in the filename.  If you don't specify a filename, DIR defaults to *.* (display all non- hidden files and subdirectories in the current directory).  To display all of the .WKS files in the current directory:

c:\> dir *.wks

With the /I option, DIR can select files to display based on their descriptions.  DIR will display a file if its description matches the text after the /I switch.  The search is not case sensitive.  You can use wildcards and extended wildcards as part of the text.  For example, to display any file described as a "Test File" you can use this command:

c:\> dir /i"test file"

If you want to display files that include the words "test file" anywhere in their descriptions, use extended wild cards like this:

c:\> dir /i"*test file*"

If you link two or more filenames together with spaces, DIR will display all of the files that match the first name and then all of the files that match the second name.  You may use a different drive and path for each filename.  This example lists all of the .WKS and then all of the .WK1 files in the current directory:

c:\> dir *.wks *.wk1

If you use an include list to link multiple filenames, DIR will display the matching filenames in a single listing.  Only the first filename in an include list can have a path; the other files must be in the same path.  This example displays the same files as the previous example, but the .WKS and .WK1 files are intermixed:

c:\> dir *.wks;*.wk1

You can display the file and subdirectory names in color by setting the COLORDIR environment variable or using the ColorDir directive in your .INI file.  See Color-Coded Directories for details.

If you are using color-coded directories and attempt to redirect the output of DIR to a character device, such as a serial port or the printer, non-color-coded file names will be displayed on the device but color-coded names may still be displayed on the screen. This will not occur if the output of DIR is redirected to a disk file.  To prevent this problem, use the /D switch to disable color coding when redirecting the output of DIR to a character device.

When displaying file descriptions, DIR will wrap long lines to fit on the screen.  DIR displays a maximum of 40 characters of text in each line of a description, unless your screen width allows a wider display.  If you disable description wrapping with the /R switch, the description is truncated at the right edge of the screen, and a right arrow is added at the end of the line to alert you to the existence of additional description text.

If you attempt to redirect the output of DIR to a character device, such as a serial port or the printer, long descriptions will be wrapped at the screen width in the redirected output.  If this is not what you want, use /R to disable wrapping.

When sorting file names and extensions, Take Command normally assumes that sequences of digits should be sorted numerically (for example, the file DRAW2 would come before DRAW03 because 2 is numerically smaller than 03), rather than strictly alphabetically (where DRAW2 would come second because "2" is after "0" in alphanumeric order). You can defeat this behavior and force a strict alphabetic sort with the /O:a option.

If you have selected a specific country code for your system, DIR will display the date in the format for that country.  The default date format is U.S. (mm-dd-yy).  The separator character in the file time will also be affected by the country code.

DIR can handle directories of any size, limited only by available memory.  Memory requirements for DIR are generally not a concern under Take Command, because of the virtual memory available under this operating system.

Options on the command line apply only to the filenames which follow the option, and options at the end of the line apply to the preceding filename only.  This allows you to specify different options for different groups of files, yet retains compatibility with the traditional DIR command when a single filename is specified.

Options

/1	Single column display  display the filename, size, date, time, and the description.  This is the default.  If /C or /O:c is used, the compression ratio is displayed instead of the description.

/2	Two column display -- display the filename, size, date, and time.

/4	Four column display -- display the filename and size, in K (kilobytes) or M (megabytes).

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is optional.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., DIR /A), DIR will display all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be included in the listing.  For example, /A:RHS will display only those files with all three attributes set.

/B	(Bare)  Suppress the header and summary lines, and display file or subdirectory names only, in a single column. This option is most useful when you want to redirect a list of names to a file or another program.  If you use /B with /S, DIR will show the full path of each file instead of simply its name and extension.

 /C	(Compression)  Display per-file and total compression ratio on compressed drives.  The compression ratio is displayed instead of the file description or attributes.  The ratio is left blank for directories and files with a length of 0 bytes and for files on non-compressed drives.  /C only works in single-column mode; it is ignored if /2, /4, or /W is used.  See APPNOTES.DOC for a list of supported compression systems.

The numerator of the displayed compression ratio is the amount of space which would be allocated to the file if the compression utility were not in use, based on the compressed drive's cluster size (usually 8K bytes).  The denominator is the space actually allocated for the compressed file.  For example, if a file is allocated 6,144 bytes when compressed, and would require 8,192 bytes if uncompressed, the displayed compression ratio would be 8,192 / 6,144, or 1.3 to 1.

Using /CH displays compression ratios like /C, but bases the calculation on the host drive's cluster size.  This gives a more accurate picture of the space saved through compression than is given by /C.  This option will occasionally display compression ratios slightly less than 1.0 to 1.0 for files which have actually expanded when stored on the compressed drive.

If /CP is used instead of /C, the compression is displayed as a percentage (e.g., 33%) instead of a ratio (e.g., 3 to 1).  If /CHP is used instead of /CH, the host compression is displayed as a percentage.  The /CHP option must be entered as shown; you can not use /CPH.

/D	(Disable color coding)  Temporarily disable directory color coding.  May be required when color-coded directories are used and DIR output is redirected to a character device like the printer (e.g., PRN or LPT1) or serial port (e.g., COM1 or COM2).  /D is not required when DIR output is redirected to a file.

/E	Display filenames in upper case; also see SETDOS /U and the UpperCase directive in TCMD.INI.

/F	(Full path)  Display each filename with its drive letter and path in a single column, without other information.

/H	(Hide dots)  Suppress the display of the "." and ".." directories.

/I	Display filenames by matching text in their descriptions.  The text can include wild cards and extended wildcards.  The search text must be enclosed in quotation marks.  /I may be used to select files even if descriptions are not displayed (for example, if /2 is used).  However, /I will be ignored if /C or /O:c is used.

/J	(Justify names)  Justify (align) filename extensions and display them in the traditional format.

/K	Suppress the header (disk and directory name) display.

/L	(Lower case)  Display file and directory names in lower case; also see SETDOS /U and the UpperCase directive in TCMD.INI.

/M	Suppress the footer (file and byte count totals) display.

/N  	(Normal) Reset the DIR options to the default values.  This is useful when you want to display some files in one format, and then change back to the defaults for another set of files.

/O	(Order) Set the sorting order.  You may use any combination of the following sorting options; if multiple options are used, the listing will be sorted with the first sort option as the primary key, the next as the secondary key, and so on:

-	Reverse the sort order for the next option

a	Sort in ASCII order, not numerically, when there are digits in the name

c	Sort by compression ratio (the least compressed file in the list will be displayed first).  For single-column directory displays, the compression ratios will be used as the basis of the sort and will also be displayed.  For wider displays (/2, /4, and /W), the compression ratios will be used to determine the order but will not be displayed.  If /O:c is used with /CH or /CHP, the sort will be based on the host-drive compression ratios.

d	Sort by date and time (oldest first)

e	Sort by extension

g	Group subdirectories first, then files

i	Sort by file description

n	Sort by filename (this is the default)

r	Reverse the sort order for all options

s	Sort by size

u	Unsorted

/P	(Pause)  Wait for a key to be pressed after each screen page before continuing the display.  Your options at the prompt are explained in detail under Page and File Prompts.

/R	(disable wRap)  Forces long descriptions to be displayed on a single line, rather than wrapped onto two or more lines.  Use /R when output is redirected to a character device, such as a serial port or the printer; or when you want descriptions truncated, rather than wrapped, in the on-screen display.

/S	(Subdirectories)  Display file information from the current directory and all of its subdirectories.  DIR will only display headers and summaries for those directories which contain files that match the filename(s) and attributes (if /A is used) that you specify on the command line.

/T	(aTtribute display)  Display the filenames, attributes, and descriptions.  /T is ignored if /C or /O:c is also used.  The descriptions will be wrapped onto the next line, if necessary unless you also use the /R (truncate) option.  If you use both /T and /R, descriptions are truncated after 34 characters on an 80-column display.  The attributes are displayed in the format RHSA, with the following meanings:

R	Read-only	S	System

H	Hidden	A	Archive

/U	(sUmmary information)  Only display the number of files, the total file size, and the total amount of disk space used.

/V	(Vertical sort)  Display the filenames sorted vertically rather than horizontally (use with the /2, /4 or /W options).

/W	(Wide)  Display filenames only, horizontally across the screen (5 columns on an 80-character wide display).


DIRS

Purpose:	Display the current directory stack.

Format:	DIRS

See also:  PUSHD and POPD.

Usage

The PUSHD command adds the current default drive and directory to the directory stack, a list that Take Command maintains in memory.  The POPD command removes the top entry of the directory stack and makes that drive and directory the new default.  The DIRS command displays the contents of the directory stack, with the most recent entries on top (i.e., the next POPD will retrieve the first entry that DIRS displays).

The directory stack holds 255 characters, enough for 10 to 20 typical drive and directory entries.


DO

Purpose:	Create loops in batch files.

Format:	DO [n | FOREVER]

    or

DO varname = start TO end [BY n ]

    or

DO [WHILE | UNTIL] condition

    ...

    [ITERATE]

    [LEAVE]

    ...

ENDDO

n, start, end:  An integer between 0 and 2,147,483,647 inclusive, or an internal variable or variable function that evaluates to such a value.

varname:  The environment variable that will hold the loop counter.

condition:  A test to determine if the loop should be executed.

Usage

DO can only be used in batch files.

DO can be used to create 3 different kinds of loops.  The first, introduced by DO n, is a counted loop.  The batch file lines between DO and ENDDO are repeated n times.  You can also specify "forever" for n if you wish to create an endless loop. For example:

do 5

beep

enddo

The second type of loop is similar to a "for loop" in programming languages like BASIC.  DO creates an environment variable, varname, and sets it equal to the value start (if varname already exists in the environment, it will be overwritten).  DO then begins the loop process by comparing the value of varname with the value of end.  If varname is less than or equal to end, DO executes the batch file lines up to the ENDDO.  Next, DO adds 1 to the value of varname, or adds the value n if BY n is specified, and repeats the compare and execute process until varname is greater than end. This example displays the even numbers from 2 through 20:

do i = 2 to 20 by 2

echo %i

enddo

DO can also count down, rather than up.  If n is negative, varname will decrease by n with each loop, and the loop will stop when varname is less than end.  For example, to display the even numbers from 2 through 20 in reverse order, replace the first line of the example above with:

do i = 20 to 2 by -2

The third type of loop is called a "while loop" or "until loop." DO evaluates the condition, which can be any of the tests supported by the IF command, and executes the lines between DO and ENDDO as long as the condition is true.  The loop ends when the condition becomes false.

WHILE tests the condition at the start of the loop; UNTIL tests it at the end.  If you use WHILE, the loop may never be executed (if the condition is false at the start of the loop); if you use UNTIL, the loop will always be executed at least once.

Two special commands, ITERATE and LEAVE, can only be used inside a DO / ENDDO loop.  ITERATE ignores the remaining lines inside the loop and returns to the beginning of loop for another iteration (unless DO determines that the loop is finished).  LEAVE exits from the current DO loop and continues with the line following ENDDO. Both ITERATE and LEAVE are most often used in an IF or IFF command:

do while "%var" != "%val1"

...

if "%var" == "%val2" leave

enddo

You can nest DO loops up to 15 levels deep.

You can exit from all DO / ENDDO loops by using GOTO to a line past the last ENDDO.  However, be sure to read the cautionary notes about GOTO and DO under the GOTO command before using a GOTO inside any DO loop.


DRAWBOX

Purpose:	Draw a box on the screen.

Format:	DRAWBOX ulrow ulcol lrrow lrcol style [BRIght] fg ON [BRIght] bg

[FILl [BRIght] bgfill] [ZOOm] [SHAdow]

ulrow:  Row for upper left corner

ulcol:  Column for upper left corner

lrrow:  Row for lower right corner

lrcol:  Column for lower right corner

style:  Box drawing style:

0	No lines (box is drawn with blanks)

1	Single line

2	Double line

3	Single line on top and bottom, double on sides

4	Double line on top and bottom, single on sides

fg:  Foreground character color

bg:  Background character color

bgfill:  Background fill color (for the inside of the box)

See also:  DRAWHLINE and DRAWVLINE.

Usage

DRAWBOX is useful for creating attractive screen displays in batch files.

For example, to draw a box around the entire screen with bright white lines on a blue background:

drawbox 0 0 24 79 1 bri whi on blu fill blu

See Colors and Color Names for details about colors.

If you use ZOOM, the box appears to grow in steps to its final size.  The speed of the zoom operation depends on the speed of your video system.

If you use SHADOW, a drop shadow is created by changing the characters in the row under the box and the 2 columns to the right of the box to normal intensity text with a black background (this will make characters displayed in black disappear entirely).

The row and column values are zero-based, so on a standard 25 line by 80 column display, valid rows are 0 - 24 and valid columns are 0 - 79.

DRAWBOX checks for valid row and column values, and displays a "Usage" error message if any values are out of range.

Unlike DRAWHLINE and DRAWVLINE, DRAWBOX does not automatically connect boxes to existing lines on the screen with the proper connector characters.  If you want to draw lines inside a box and have the proper connectors drawn automatically, draw the box first, then use DRAWHLINE and DRAWVLINE to draw the lines.

DRAWBOX uses the standard line and box drawing characters in the U.S. English extended ASCII character set.  If your system is configured for a different country or language, the box may not appear on your screen as you expect.  The box will only appear correctly if you have configured Take Command to use a font, such as Terminal, which contains standard extended ASCII characters.


DRAWHLINE

Purpose:	Draw a horizontal line on the screen.

Format:	DRAWHLINE row column len style [BRIght] fg ON [BRIght] bg

row:  Starting row

column:  Starting column

len:  Length of line

style:  Line drawing style:

1     Single line

2     Double line

fg:  Foreground character color

bg:  Background character color

See also:  DRAWBOX and DRAWVLINE.

Usage

DRAWHLINE is useful for creating attractive screen displays in batch files.  It detects other lines and boxes on the display, and creates the appropriate connector characters when possible (not all types of lines can be connected with the available characters).

For example, the following command draws a double line along the top row of the display with green characters on a blue background:

drawhline 0 0 80 2 green on blue

The row and column values are zero-based, so on a standard 25 line by 80 column display, valid rows are 0 - 24 and valid columns are 0 - 79.  DRAWHLINE checks for a valid row and column, and displays a "Usage" error message if either value is out of range.

See Colors and Color Names for details about colors.

DRAWHLINE uses the standard line and box drawing characters in the U.S. English extended ASCII character set.  If your system is configured for a different country or language, the line may not appear on your screen as you expect.  The line will only appear correctly if you have configured Take Command to use a font, such as Terminal, which contains standard extended ASCII characters.


DRAWVLINE

Purpose:	Draw a vertical line on the screen.

Format:	DRAWVLINE row column len style [BRIght] fg ON [BRIght] bg

row:  Starting row

column:  Starting column

len:  Length of line

style:  Line drawing style:

1     Single line

2     Double line

fg:  Foreground character color

bg:  Background character color

See also:  DRAWBOX and DRAWHLINE.

Usage

DRAWVLINE is useful for creating attractive screen displays in batch files.  It detects other lines and boxes on the display, and creates the appropriate connector characters when possible (not all types of lines can be connected with the available characters).

For example, to draw a double width line along the left margin of the display with bright red characters on a black background:

drawvline 0 0 25 2 bright red on black

The row and column values are zero-based, so on a standard 25 line by 80 column display, valid rows are 0 - 24 and valid columns are 0 - 79.  DRAWVLINE checks for a valid row and column, and displays a "Usage" error message if either value is out of range.

See Colors and Color Names for details about colors.

DRAWVLINE uses the standard line and box drawing characters in the U.S. English extended ASCII character set.  If your system is configured for a different country or language, the line may not appear on your screen as you expect.  The line will only appear correctly if you have configured Take Command to use a font, such as Terminal, which contains standard extended ASCII characters.


ECHO

Purpose:	Display a message, enable or disable batch file or command-line echoing, or display the echo status.

Format:	ECHO [ON | OFF | message ]

message:  Text to display.

See also:  ECHOS, SCREEN, SCRPUT, SETDOS and TEXT.

Usage

Take Command has a separate echo capability for batch files and for the command line.  The command-line ECHO state is independent of the batch file ECHO state; changing ECHO in a batch file has no effect on the display at the command prompt, and vice versa.

To see the current echo state, use the ECHO command with no arguments.  This displays either the batch file or command-line echo state, depending on where the ECHO command is performed.

In a batch file, if you turn ECHO on, each line of the file is displayed before it is executed.  If you turn ECHO off, each line is executed without being displayed.  ECHO can also be used in a batch file to display a message on the screen.  Regardless of the ECHO state, a batch file line that begins with the [@] character will not be displayed.  To turn off batch file echoing, without displaying the ECHO command, use this line:

@echo off

ECHO commands in a batch file will send messages to the screen while the batch file executes, even if ECHO is set OFF.  For example, this line will display a message in a batch file:

echo Processing your print files...

If you want to echo a blank line from within a batch file, enter:

echo.

You cannot use the command separator character [^], or the redirection symbols [| > <] in an ECHO message, unless you enclose them in quotes (see Argument Quoting) or precede them with the escape character.

ECHO defaults to ON in batch files.  The current ECHO state is inherited by called batch files.  You can change the default setting to ECHO OFF with the SETDOS /V0 command or the BatchEcho directive in the .INI file.

If you turn the command-line ECHO on, each command will be displayed before it is executed.  This will let you see the command line after expansion of all aliases and variables.  The command- line ECHO is most useful when you are learning how to use advanced features.  This example will turn command-line echoing on:

c:\> echo on

ECHO defaults to OFF at the command line.


ECHOS

Purpose:	Display a message without a trailing carriage return and line feed.

Format:	ECHOS message

message:  Text to display.

See also:  ECHO, SCREEN, SCRPUT, TEXT, and VSCRPUT.

Usage

ECHOS is useful for text output when you don't want to add a carriage return / linefeed pair at the end of the line.  For example, you can use ECHOS when you need to redirect control sequences to your printer; this example sends the sequence Esc P to the printer on LPT1:

c:\> echos eP > lpt1:

You cannot use the command separator character [^] or the redirection symbols [| > <] in an ECHOS message, unless you enclose them in quotes (see Argument Quoting) or precede them with the escape character.

ECHOS does not translate or modify the message text.  For example, carriage return characters are not translated to CR/LF pairs. ECHOS sends only the characters you enter (after escape character and back quote processing).  The only character you cannot put into an ECHOS message is the NUL character (ASCII 0).


ENDLOCAL

Purpose:	Restore the saved disk drive, directory, environment, and alias list.

Format:	ENDLOCAL

See also:  SETLOCAL.

Usage

The SETLOCAL command in a batch file saves the current disk drive, default directory, all environment variables, and the alias list. ENDLOCAL restores everything that was saved by the previous SETLOCAL command.

SETLOCAL and ENDLOCAL can only be used in batch files, not in aliases or from the command line.


ESET

Purpose:	Edit environment variables and aliases.

Format:	ESET [/A] variable name...

variable name:  The name of an environment variable or alias to edit.

/A(lias)

See also:  ALIAS, UNALIAS, SET, and UNSET.

Usage

ESET allows you to edit environment variables and aliases using line editing commands (see Command-Line Editing).

For example, to edit the executable file search path:

c:\> eset path

path=c:\;c:\dos;c:\util

To create and then edit an alias:

c:\> alias d = dir /d/j/p

c:\> eset d

d=dir /d/j/p

ESET will search for environment variables first and then aliases. If you have an environment variable and an alias with the same name, ESET will edit the environment variable and ignore the alias unless you use the /A option.

Environment variable and alias names are normally limited to 80 characters, and their contents to 1,023 characters.  However, if you use special techniques to create a longer environment variable, ESET will edit it provided the variable contains no more than 2,047 characters of text.

Option

/A	(Alias) Edit the named alias even if an environment variable of the same name exists.  If you have an alias and an environment variable with the same name, you must use this switch to be able to edit the alias.


EXCEPT

Purpose:	Perform a command on all available files except those specified.

Format:	EXCEPT (file ) command

file:  The file or files to exclude from the command.

command:  The command to execute, including all appropriate arguments and switches.

See also:  ATTRIB.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists. Date, time, or size ranges must appear immediately after the EXCEPT keyword.

Usage

EXCEPT provides a means of executing a command on a group of files and/or subdirectories, and excluding a subgroup from the operation. The command can be an internal command or alias, an external command, or a batch file.

You may use wildcards to specify the files to exclude from the command.  The first example erases all the files in the current directory except those beginning with MEMO, and those whose extension is .WKS.  The second example copies all the files and subdirectories on drive C to drive D except those in C:\MSC and C:\DOS, using the COPY command:

c:\> except (memo*.* *.wks) erase *.*

c:\> except (c:\msc c:\dos) copy c:\*.* d:\ /s

Date, time, and size ranges can be used immediately after the word EXCEPT to further qualify which files should be excluded from the command.  If the command is an internal command that supports ranges, an independent range can also be used in the command itself.

EXCEPT prevents operations on the specified file(s) by setting the hidden attribute, performing the command, and then clearing the hidden attribute.  If the command is aborted in an unusual way, you may need to use the ATTRIB command to remove the hidden attribute from the file(s).

Caution:  EXCEPT will not work with programs or commands that ignore the hidden attribute or which work explicitly with hidden files, including DEL /Z, and the /H (process hidden files) switch available in some Take Command file processing commands.

You can use command grouping to execute multiple commands with a single EXCEPT.  For example, the following command copies all files in the current directory whose extensions begin with .DA, except the .DAT files, to the D:\SAVE directory, then changes the first two characters of the extension of the copied files to .SA:

c:\data> except (*.dat) (copy *.da* d:\save & ren *.da* *.sa*)

If you use filename completion (see Filename Completion) to enter the filenames inside the parentheses, type a space after the open parenthesis before entering a partial filename or pressing Tab.  Otherwise, the command-line editor will treat the open parenthesis as the first character of the filename to be completed.


EXIT

Purpose:	Return from Take Command.

Format:	EXIT [value ]

value:  The exit code to return (0 - 255).

Usage

EXIT terminates the current copy of Take Command.

To close the session, or to return to the application that started Take Command, type:

c:\> exit

If you specify a value, EXIT will return that value to the program that started Take Command.  For example:

c:\> exit 255

The value is a number you can use to inform the program of some result, such as the success or failure of a batch file.


FFIND

Purpose:	Search for files by name or contents.

Format:	FFIND [/A[[:][-]rhsda] /B /C /D[list] /E /K /L /M /O[[:][-]acdeginrsu] /P /Q /S /T"xx" /V /X["xx xx ...]] file...

file:  The file, directory, or list of files or directories to display.

/A(ttribute select)	/M (no footers)

/B(are)	/O(rder)

/C(ase sensitive)	/P(ause)

/D(rive)	/S(ubdirectories)

/E (upper case display)	/T"xx" (text search string)

/K (no headers)	/V (all matching lines)

/L(ine numbers)	/X["xx"] (hex display / search string)

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

FFIND is a flexible search command that looks for files based on their names and their contents. Depending on the options you choose, FFIND can display filenames, matching text, or a combination of both in a variety of formats.

If you want to search for files by name, FFIND works much like the DIR command.  For example, to generate a list of all the .BTM files inthe current directory, you could use the command

c:\> ffind *.btm

The output from this command is a list of full pathnames, followed by the number of files found.

If you want to limit the output to a list of *.BTM files which contain the string color, you could use this command instead:

c:\> ffind /t"color" *.btm

The output from this version of FFIND is a list of files that contain the string color along with the first line in each file that contains that string.  By default, FFIND uses a case-insensitive search, so the command above will include files that contain COLOR, Color, color, or any other combination of upper-case and lower-case letters.

You can use Take Command's extended wildcards in the search string to increase the flexibility of FFIND's search.  For example, the following command will find .TXT files which contain either the string June or July.  It will also find Juny and Jule.  The /C option makes the search case-sensitive:

c:\> ffind /c/t"Ju[nl][ey]" *.txt

At times, you may need to search for data that cannot be represented by ASCII characters.  You can use FFIND's /X option to represent the search string in hexadecimal format.  With the /X option, the search must be represented by pairs of hexadecimal digits separated by spaces (41 63 65 is the hex code for "Ace"):

c:\> ffind /b"41 63 65" *.txt

You can use FFIND's other options to further specify the files for which you are searching and to modify the way in which the output is displayed.

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., FFIND /A), FFIND will search all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be included in the search.  For example, /A:RHS will display only those files with all three attributes set.

/B	(Bare) Display file names only and omit the text that matches the search.  This option is only useful in combination with /T or /X, which normally force FFIND to display file names and matching text.

/C	(Case sensitive) Perform a case-sensitive search.  This option is only valid with /T, which defaults to a case-insensitive search.  It is not needed with a /X hexadecimal search, which is always case-sensitive.

/D	(Drive)  Search all files on one or more drives.  If you use /D without a list of drives, FFIND will search the drives specified in the list of files.  If no drive letters are listed, FFIND will search the default drive.  You can include a list of drives or a range of drives to search as part of the /D option.  For example, to search drives C:, D:, E:, and G:, you can use either of these commands:

 [c:\> ffind /dcdeg ...

c:\> ffind /dc-eg ...

/E	(Upper case display) Display matching filenames in upper-case characters.

/K	(No headers)  Suppress the display of the header or filename for each matching text line.

/L	(Line numbers)  Include the line number for each text line displayed.

/M	(No footers)  Suppress the footer (the number of files and number of matches) at the end of FFIND's display.

/O	(Order)  Set the sort order for the files that FFIND displays.  You may use any combination of the following sorting options; if multiple options are used, the listing will be sorted with the first sort option as the primary key, the next as the secondary key, and so on:

-	Reverse the sort order for the next option

a	Sort in ASCII order, not numerically, when there are digits in the name

c	Sort by compression ratio (the least compressed file will be displayed first).

d	Sort by date and time (oldest first)

e	Sort by extension

g	Group subdirectories first, then files

i	Sort by file description

n	Sort by filename (this is the default)

r	Reverse the sort order for all options

s	Sort by size

u	Unsorted

/P	(Pause) Wait for a key to be pressed after each screen page before continuing the display.  Your options at the prompt are explained in detail under Page and File Prompts.

/S	(Subdirectories)  Display matches from the current directory and all of its subdirectories.

/T"xx"	(Text search)  Specify the text search string.  /T must be followed by a text string in double quotes (e.g., /t"color").  FFIND will perform a case-insensitive search unless you also use the /C option.  For a hexadecimal search and/or hexadecimal display of the location where the search string is found, see /X.

/V	(All matching lines) Show every matching line (only valid with /T or /X).  FFIND's default behavior is to show only the first matching line then and then go on to the next file.  This option is only valid with /T or /X.

/X["xx xx ..."]  (Hexadecimal display / search)  Specify hexadecimal display and an optional hexadecimal search string.

If /X is followed by one or more pairs of hexadecimal digits in quotes (e.g., /x"44 63 65"), FFIND will search for that exact sequence of characters or data bytes without regard to the meaning of those bytes as text.  If those bytes are found, the offset is displayed (also in hexadecimal).  A search of this type will always be case-sensitive.

If /X is not followed by a hexadecimal search string it must be used in conjunction with /T, and will change the output format to display hexadecimal offsets rather than actual text lines when the search string is found.  For example, this command uses /T to display the first line in each BTM file containing the word "hello":

c:\> ffind /t"hello" *.btm

--- c:\test.btm:

echo hello

If you use the same command with /X, the hexadecimal offset is displayed instead of the text:

c:\> ffind /t"hello" /x *.btm

--- c:\test.btm:

Offset: 1A

You can specify a search string with either /T or /X, but not both.


FOR

Purpose:	Repeat a command for several values of a variable.

Format:	FOR [/A[[:][-]rhsda] /D] %var IN ([@]set ) DO] command ...

%var:  The variable to be used in the command ("FOR variable").

set:  A set of values for the variable.

command:  A command or group of commands to be executed for each value of the variable.

/A(ttribute select)	/H(ide dots)

/D(isable '/' processing)

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists. Date, time, or size ranges must appear immediately after the FOR keyword.

Usage

FOR begins by creating a set.  It then executes a command for every member of the set.  The command can be an internal command, an alias, an external command, or a batch file.

Normally, the set is a list of files specified with wildcards.  For example, if you use this line in a batch file:

for %x in (*.txt) do list %x

then LIST will be executed once for each file in the current directory with the extension .TXT.  The FOR variable %x is set equal to each of the file names in turn, then the LIST command is executed for each file.  (You could do the same thing more easily with a simple LIST *.TXT.  We used FOR here so you could get a feel for how it operates, using a simple example.)

The set can include multiple files or an include list, like this:

for %x in (d:\*.txt;*.doc;*.asc) do type %x

If the set includes filenames, the file list can be further refined by using date, time, and size ranges.  The range must be placed immediately after the word FOR.  The range will be ignored if no wildcards are used inside the parentheses.  For example, this set is made up of all of the *.TXT files that were created or updated on October 4, 1994:

for /[d10-4-94,+0] %x in (*.txt) do ...

If the command is an internal command that supports ranges, an independent range can also be used in the command itself.

The set can also be made up of text instead of file names.  For example, to display the free space on drives C:, D:, and E:, you could use:

for %drive in (c d e) do free %drive:

When the set is made up of text or several separate file names (not an include list), the elements must be separated by spaces, tabs, commas, or the switch character (normally a slash [/]).

You can also set the FOR variable equal to each line in a file by placing an [@] in front of the file name.  If you have a file called DRIVES.TXT that contains a list of drives on your computer, one drive name per line (with a ":" after each drive letter), you can print the free space on each drive this way:

for %d in (@drives.txt) do free %d > prn

Because the [@] is also a valid filename character, FOR first checks to see if the file exists with the [@] in its name (i.e., a file named @DRIVES.TXT ).  If so, the filename is treated as a normal argument.  If it doesn't exist, FOR uses the filename (without the [@]) as the file from which to retrieve text.

You can use either % or %% in front of the variable name. Either form will work, whether the FOR command is typed from the command line or is part of an alias or batch file (some of the traditional command processors require a single % if FOR is used at the command line, but use %% if it is used in a batch file).  The variable name can be up to 80 characters long.  The word DO is optional.

If you use a single-character FOR variable name, that name is given priority over any environment variable which starts with the same letter, in order to maintain compatibility with the traditional FOR command.  For example, the following command tries to add a: and b: to the end of the PATH, but will not work as intended:

c:\> for %p in (a: b:) do path %path;%p

The "%p" in "%path" will be interpreted as the FOR variable %p followed by the text "ath", which is not what was intended.  To get around this, use a different letter or a longer name for the FOR variable, or use square brackets around the variable name (see Environment).

The following example uses FOR with variable functions to delete the .BAK files for which a corresponding .TXT file exists in the current directory:

c:\docs> for %file in (*.txt) do del %@name[%file].bak

You can use command grouping to execute multiple commands for each element in the list.  For example, the following command copies each .WKQ file in the current directory to the D:\WKSAVE directory, then changes the extension of each file in the current directory to .SAV.  This should be entered on one line:

c:\text> for %file in (*.wkq) do (copy %file d:\wksave\ ^ ren %file *.sav)

In a batch file you can use GOSUB to execute a subroutine for every element in the set.  Within the subroutine, the FOR variable can be used just like any environment variable.  This is a convenient way to execute a complex sequence of commands for every element in the set without CALLing another batch file.

One unusual use of FOR is to execute a collection of batch files or other commands with the same parameter.  For example, you might want to have three batch files all operate on the same data file. The FOR command could look like this:

c:\> for %cmd in (filetest fileform fileprnt) do %cmd datafile

This line will expand to three separate commands:

filetest datafile

fileform datafile

fileprnt datafile

The variable that FOR uses (the %CMD in the example above) is created in the environment and then erased when the FOR command is done.  However, for compatibility with CMD.EXE, single-character FOR variables do not overwrite existing environment variables with the same name.  As a result, when using a multi-character variable name you must be careful not to use the name of one of your environment variables as a FOR variable.  For example, a command that begins

c:\> for %path in ...

will write over your current path setting and then erase the path variable completely.

FOR statements can be nested.

Options

/A	(Attribute select) Process only those files that have the specified attribute(s).  /A will be used only when processing wildcard file names in the set.  It will be ignored for filenames without wildcards or other items in the set.  Preceding the attribute character with a hyphen [-] will process files that do not have that attribute set.  The colon [:] after ?A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed (e.g., FOR /A ...), FOR will process all files including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be included.  For example, /A:RHS will include only those files with all three attributes set.

For example, to process only those files with the archive attribute set:

for /a:a %f in (*.*) echo %f needs a backup!

/D	(Disable '/' processing) Disable special processing of the '/' in the FOR argument group.  Take Command and traditional command processors normally treat '/' as an escape character and return the next character as the next argument, followed by the remainder of the string as the following argument.  /D disables this special use of the forward slash.  The /D switch must follow the FOR keyword and come before the variable name.

/H	(Hide dots)  Suppress the display of the "." and ".." directories.


FREE

Purpose:	Display the total disk space, total bytes used, and total bytes free on the specified (or default) drive(s).

Format:	FREE [drive: ... ]

drive:  One or more drives to include in the report.

See also:  MEMORY.

Usage

FREE provides the same disk information as the external command CHKDSK, but without the wait, since it does not check the integrity of the file and directory structure of the disk.

A colon [:] is required after each drive letter.  This example displays the status of drives A and C:

c:\> free a: c:


GLOBAL

Purpose:	Execute a command in the current directory and its subdirectories.

Format:	GLOBAL [/H /I /P /Q] command

command:  The command to execute, including arguments and switches.

/H(idden directories)	/P(rompt)

/I(gnore exit codes)	/Q(uiet)

Usage

GLOBAL performs the command first in the current directory and then in every subdirectory under the current directory.  The command can be an internal command, an alias, an external command, or a batch file.

This example copies the files in every directory on drive A to the directory C:\TEMP:

a:\> global copy *.* c:\temp

If you use the /P option, GLOBAL will prompt for each subdirectory before performing the command.  You can use this option if you want to perform the command in most, but not all subdirectories of the current directory.

You can use command grouping to execute multiple commands in each subdirectory.  For example, the following command copies each .TXT file in the current directory and all of its subdirectories to drive A.  It then changes the extension of each of the copied files to .SAV:

c:\> global (copy *.txt a: ^ ren *.txt *.sav)

Options

/H	(Hidden directories) Forces GLOBAL to look for hidden directories.  If you don't use this switch, hidden directories are ignored.

/I	(Ignore exit codes) If this option is not specified, GLOBAL will terminate if the command returns a non- zero exit code.  Use /I if you want command to continue in additional subdirectories even if it returns an error in a previous subdirectory.  Even if you use /I, GLOBAL will halt execution in response to Ctrl-C or Ctrl-Break.

/P	(Prompt) Forces GLOBAL to prompt with each directory name before it performs the command.  Your options at the prompt are explained in detail under Page and File Prompts.

/Q	(Quiet) Do not display the directory names as each directory is processed.


GOSUB

Purpose:	Execute a subroutine in the current batch file.

Format:	GOSUB label

label:  The batch file label at the beginning of the subroutine.

See also:  CALL, GOTO and RETURN.

Usage

GOSUB can only be used in batch files.

Take Command allows subroutines in batch files.  A subroutine must start with a label (a colon [:] followed by a one-word label name) which appears on a line by itself.  Case differences are ignored when matching labels.  The subroutine must end with a RETURN statement.

The subroutine is invoked with a GOSUB command from another part of the batch file.  After the RETURN, processing will continue with the command following the GOSUB command.  For example, the following batch file fragment calls a subroutine which displays the directory and returns:

echo Calling a subroutine

gosub subr1

echo Returned from the subroutine

quit

:subr1

dir /a/w

return

If the label doesn't exist, the batch file is terminated with the error message "Label not found."

GOSUB saves the IFF state, so IFF statements inside a subroutine won't interfere with IFF statements in the part of the batch file from which the subroutine was called.

Subroutines can be nested.


GOTO

Purpose:	Branch to a specified line inside the current batch file.

Format:	GOTO [/I] label

label:  The batch file label to branch to.

/I(FF and DO continue)

See also:  GOSUB.

Usage

GOTO can only be used in batch files.

After a GOTO command in a batch file, the next line to be executed will be the one immediately after the label.  The label must begin with a colon [:] and appear on a line by itself. The colon is required on the line where the label is defined, but is not required in the GOTO command itself.  Case differences are ignored when matching labels.

This batch file fragment checks for the existence of the file CONFIG.NT.  If the file exists, the batch file jumps to C_EXISTS and copies all the files from the current directory to the root directory on A:.  Otherwise, it prints an error message and exits.

if exist config.nt goto C_EXISTS

echo CONFIG.NT doesn't exist - exiting.

quit

:C_EXISTS

copy *.* a:\

If the label doesn't exist, the batch file is terminated with the error message "Label not found."

To avoid errors in the processing of nested statements and loops, GOTO cancels all active IFF statements and DO / ENDDO loops unless you use /I.  This means that a normal GOTO (without /I) may not branch to any label that is between an IFF and the corresponding ENDIFF or between a DO and the corresponding ENDDO.

Options

/I	(IFF and DO continue) Prevents GOTO from canceling IFF statements and DO loops.  Use this option only if you are absolutely certain that your GOTO command is branching entirely within any current IFF statement and any active DO / ENDDO block.  Using /I under any other conditions will cause an error later in your batch file.

You cannot branch into another IFF statement, another DO loop, or a different IFF or DO nesting level, whether you use the /I option or not.  If you do, you will eventually receive an "unknown command" error (or execution of the UNKNOWN_CMD alias) on a subsequent ENDDO, ELSE, ELSEIFF, or ENDIFF statement.


HELP

Purpose:	Display help for internal commands, and optionally for external commands.

Format:	HELP [topic ]

topic:  A help topic, internal command, or external command.

Usage

Online help is available for Take Command.  The Take Command help system uses the Windows help facility.

If you type the command HELP by itself (or press F1 when the command line is empty), the table of contents is displayed.  If you type HELP plus a topic name, that topic is displayed.  For example,

help copy

displays information about the COPY command and its options.


HISTORY

Purpose:	Display, add to, clear, or read the history list.

Format:	HISTORY [/A command /F /P /R filename]

/A(dd)	/P(ause)

/F(ree)	/R(ead)

See also:  LOG.

Usage

Take Command keeps a list of the commands you have entered on the command line.  See Command History and Recall for additional details.

The HISTORY command lets you view and manipulate the command history list directly.  If no parameters are entered, HISTORY will display the current command history list:

c:\> history

With the options explained below, you can clear the list, add new commands to the list without executing them, save the list in a file, or read a new list from a file.

The number of commands saved in the history list depends on the length of each command line.  The history list size can be specified at startup from 256 to 8192 characters (see the History directive).  The default size is 1024 characters.

You can use the HISTORY command as an aid in writing batch files by redirecting the HISTORY output to a file and then editing the file appropriately.  However, it is easier to use the LOG /H command for this purpose.

You can disable the history list or specify a minimum command-line length to save with the HistMin directive in the .INI file.

Options

/A	(Add) Add a command to the history list.  This performs the same function as the Ctrl-K key at the command line (see Command History and Recall).

/F	(Free) Erase all entries in the command history list.

/P	(Prompt) Wait for a key after displaying each page of the list.  Your options at the prompt are explained in detail under Page and File Prompts.

/R	(Read) Read the command history from the specified file and append it to the history list currently held in memory.  Each line in the file must fit within the command-line length limit).

You can save the history list by redirecting the output of HISTORY to a file.  This example saves the command history to a file called HISTFILE and reads it back again immediately.  If you leave out the HISTORY /F command on the second line, the contents of the file will be appended to the current history list instead of replacing it:

c:\> history > histfile

c:\> history /f

c:\> history /r histfile

If you need to save your history at the end of each day's work, you might use commands like this in your TCSTART.BTM or other startup file:

if exist c:\histfile history /r c:\histfile

alias shut*down `history > c:\histfile`

This restores the previous history list if it exists, then defines an alias which will save the history before shutting off the system.

If you are creating a HISTORY /R file by hand, and need to create an entry that spans multiple lines in the file, you can do so by terminating each line, except the last, with an escape character.  However, you cannot use this method to exceed the command-line length limit.


IF

Purpose:	Execute a command if a condition or set of conditions is true.

Format:	IF [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

condition:  A test to determine if the command should be executed.

command:  The command to execute if the condition is true.

See also:  IFF.

Usage

IF is normally used only in aliases and batch files.  It is always followed by one or more conditions and then a command. First, the conditions are evaluated.  If they are true, the command is executed.  Otherwise, the command is ignored. If you add a NOT before a condition, the command is executed only when the condition is false.

You can link conditions with .AND., .OR., or .XOR., and you can nest IF statements.  The conditions can test strings, numbers, the existence of a file or subdirectory, the exit code returned by the preceding external command, and the existence of alias names and internal commands.

The command can be an alias, an internal command, an external command, or a batch file.  The entire IF statement, including all conditions and the command, must fit on one line.

You can use command grouping to execute multiple commands if the condition is true.  For example, the following command tests if any .TXT files exist.  If they do, they are copied to drive A: and their extensions are changed to .TXO:

if exist *.txt (copy *.txt a: ^ ren *.txt *.txo)

(Note that the IFF command provides a more structured method of executing multiple commands if a condition or set of conditions is true.)

Conditions

The following conditional tests are available in both the IF and IFF commands.  They fit into two categories:  string and numeric tests, and status tests.  The tests can use environment variables, internal variables and variable functions, file names, literal text, and numeric values as their arguments.

Spaces are required on either side of the test condition in all cases, except == which will work with or without spaces around it.

String and Numeric Tests

Six test conditions can be used to test character strings.  The same conditions are available for both numeric and normal text strings (see below for details).  In each case you enter the test as:

string1 operator string2

The operator defines the type of test (equal, greater than or equal, and so on).  The operators are:

EQ or ==	string1 equal to string2

NE or !=	string1 not equal to string2

LT	string1 less than string2

LE	string1 less than or equal to string2

GE	string1 greater than or equal to string2

GT	string1 greater than string2

Status Tests

These conditions test the system or command processor status.  You can use internal variables and variable functions to test many other parts of the system status.

ERRORLEVEL [operator] n	This test retrieves the exit code of the preceding external program.  By convention, programs return an exit code of 0 when they are successful and a number between 1 and 255 to indicate an error.  The condition can be any of the operators listed above (EQ, !=, GT, etc.).  If no operator is specified, the default is GE.  The comparison is done numerically.

Not all programs return an explicit exit code.  For programs which do not, the behavior of ERRORLEVEL is undefined.

EXIST filename	If the file exists, the condition is true.  You can use wildcards in the filename, in which case the condition is true if any file matching the wildcard name exists.

ISALIAS aliasname	If the name is defined as an alias, the condition is true.

ISDIR path	If the subdirectory exists, the condition is true.

ISINTERNAL command	If the specified command is an active internal command, the condition is true.  Commands can be activated and deactivated with the SETDOS /I command.

ISLABEL label	If the specified batch file label exists, the condition is true.

ISWINDOW "title"	If the window with the title exists, the condition is true.  Double quotes must be used around the title.

Combining Tests

You can negate the result of any test with NOT, and combine tests of any type with .AND., .OR., and .XOR.  Test conditions are always scanned from left to right -- there is no implied order of precedence, as there is in some programming languages.

When two tests are combined with .AND., the result is true if both individual tests are true.  When two tests are combined with .OR., the result is true if either (or both) individual tests are true.  When two tests are combined with .XOR., the result is true only if one of the tests is true and the other is false.

Using the IF Tests

When IF compares two character strings, it will use either a numeric comparison or a string comparison.  A numeric comparison treats the strings as numeric values and tests them arithmetically.  A string comparison treats the strings as text.

The difference between numeric and string comparisons is best explained by looking at the way two values are tested.  For example, consider comparing the values 2 and 19.  Numerically, 2 is smaller, but as a string it is "larger" because its first digit is larger than the first digit of 19.  So the first of these condition s will be true, and the second will be false:

if 2 lt 19 ...

if "2" lt "19" ...

IF determines which kind of test to do by examining the first character of each string.  If both strings begin with a numeric character (a digit, sign, or decimal point), a numeric comparison is used.  If either value does not begin with a numeric character, a string comparison is used.  To force a string comparison when both values are or may be numeric, use double quotes around the values you are testing, as shown above.  Because the double quote is not a numeric character, it forces IF to do a string comparison.

Case differences are ignored in string comparisons.  If two strings begin with the same text but one is shorter, the shorter string is considered to be "less than" the longer one.  For example, "a" is less than "abc", and "hello_there" is greater than "hello".

When you compare text strings, you should always enclose the arguments in double quotes in order to avoid syntax errors which may occur if one of the argument values is empty.

Numeric comparisons work with both integer and decimal values.  The values to be compared must contain only numeric digits, decimal points, and an optional sign (+ or -).  The number to the left of the decimal point may not exceed 2,147,483,648 (the maximum possible 32-bit positive integer).  The number of digits to the right of the decimal point is limited only by the length of the command line.

Internal variables and variable functions are very powerful when combined with string and numeric comparisons.  They allow you to test the state of your system, the characteristics of a file, date and time information, or the result of a calculation.  You may want to review the variables and variable functions when determining the best way to set up an IF test.

This batch file fragment tests for a string value:

input "Enter your selection : " %%cmd

if "%cmd" == "WP" goto wordproc

if "%cmd" NE "GRAPHICS" goto badentry

This example calls GO.BTM if the first two characters in the file MYFILE are "GO" (enter this example on one line):

if "%@instr[0,2,%@line[myfile,0]]"=="GO" call go.btm

This batch file fragment tests for the existence of A:\JAN.DOC before copying it to drive C.

if exist a:\jan.doc copy a:\jan.doc c:\

This example tests the exit code of the previous program and stops all batch file processing if an error occurred:

if errorlevel==0 goto success

echo "External Error -- Batch File Ends!"

cancel


IFF

Purpose:	Perform IF / THEN / ELSE conditional execution of commands.

Format:	IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] THEN ^ commands

[ELSEIFF condition  THEN ^ commands ] ...

[ELSE ^ commands ]

& ENDIFF

condition:  A test to determine if the command(s) should be executed.

commands:  One or more commands to execute if the condition(s) is true.  If you use multiple commands, they must be separated by command separators or be placed on separate lines of a batch file.

See also:  IF.

Usage

IFF is similar to the IF command, except that it can perform one set of commands when a condition or set of conditions is true and different commands when the conditions are false.

IFF can execute multiple commands when the conditions are true or false; IF normally executes only one command.  IFF imposes no limit on the number of commands and is generally a "cleaner" and more structured command than IF.

IFF is always followed by one or more conditions.  If they are true, the commands that follow the word THEN are executed. Additional conditions can be tested with ELSEIFF.  If none of these conditions are true, the commands that follow the word ELSE are executed.  In both cases, after the selected commands are executed, processing continues after the word ENDIFF.

If you add a NOT before the condition, the THEN commands are executed only when the condition is false and the ELSE commands are executed only when the condition is true.

The commands may be separated by command separators, or may be on separate lines of a batch file.  You should include a command separator or a line break after a THEN, before an ELSEIFF, and before and after an ELSE.

You can link conditions with .AND., .OR., or .XOR., and you can nest IFF statements up to 15 levels deep.  The conditions can test strings or numbers, the existence of a file or subdirectory, the errorlevel returned from the preceding external command, and the existence of alias names and internal commands.

See the IF command for a list of the possible conditions.

The commands can include any internal command, alias, external command, or batch file.

The alias in this example checks to see if the argument is a subdirectory.  If so, the alias deletes the subdirectory's files and removes it (enter this on one line):

c:\> alias prune `iff isdir %1 then ^ del /sxz %1 ^ else ^ echo Not a directory! ^ endiff`

Be sure to read the cautionary notes about GOTO and IFF under the GOTO command before using a GOTO inside an IFF statement.

If you want to use a pipe to send information from a previous command to a command inside an IFF, use command grouping around the IFF command.  For example:

type myfile.txt | (iff %_batch ne 0 then ^ list /s

If you do not use command grouping, piping will work only to the first command after the IFF.


INKEY

Purpose:	Get a single keystroke from the user and store it in an environment variable.

Format:	INKEY [/C /D /K"keys" /P /Wn /X] [prompt ] %%varname

prompt:  Optional text that is displayed as a prompt.

varname:  The variable that will hold the user's keystroke.

/C(lear buffer)	/P(assword)

/D(igits only)	/W(ait)

/K (valid keystrokes)	/X (no carriage return)

See also:  INPUT.

Usage

INKEY optionally displays a prompt.  Then it waits for a specified time or indefinitely for a keystroke, and places the keystroke into an environment variable.  It is normally used in batch files and aliases to get a menu choice or other single-key input.  Along with the INPUT command, INKEY allows great flexibility in reading input from within a batch file or alias.

If prompt text is included in an INKEY command, it is displayed while INKEY waits for input.

The following batch file fragment prompts for a character and stores it in the variable NUM:

inkey Enter a number from 1 to 9:  %%num

INKEY reads standard input for the keystroke, so it will accept keystrokes from a redirected file.  You can supply a list of valid keystrokes with the /K option.

Standard keystrokes with ASCII values between 1 and 255 are stored directly in the environment variable.  Extended keystrokes (for example, function keys and cursor keys) are stored as a string in decimal format, with a leading @ (for example, the F1 key is @59).  The Enter key is stored as an extended keystroke, with the code @28.  See the Key Code Tables for a list of extended key codes.

If you press Ctrl-C or Ctrl-Break while INKEY is waiting for a key, execution of an alias will be terminated, and execution of a batch file will be suspended while you are asked whether to cancel the batch job.  In a batch file you can handle Ctrl-C and Ctrl-Break yourself with the ON BREAK command.

Options

/C	(Clear buffer) Clears the keyboard buffer before INKEY accepts keystrokes.  If you use this option, INKEY will ignore any keystrokes which you type, either accidentally or intentionally, before INKEY is ready to accept input.

/D	(Digits only):  Prevents INKEY from accepting any keystroke except a digit from 0 to 9.

/K["keys"]  Specify the permissible keystrokes.  The list of valid keystrokes should be enclosed in double quotes.  For alphabetic keys the validity test is not case sensitive.  You can specify extended keys by enclosing their names in square brackets (within the quotes), for example:

inkey /k"ab[Alt-F10]" Enter A, B, Alt-F10 %%var

See Keys and Key Names for a complete listing of the key names you can use within the square brackets, and a description of the key name format.

If an invalid keystroke is entered, Take Command will echo the keystroke if possible, beep, move the cursor back one character, and wait for another keystroke.

/P	(Password) Prevents INKEY from echoing the character.

/W	(Wait) Time-out period, in seconds, to wait for a response. If no keystroke is entered by the end of the time-out period, INKEY returns with the variable unchanged. You can specify /W0 to return immediately if there are no keys waiting in the keyboard buffer.

For example, the following batch file fragment waits up to 10 seconds for a character, then tests to see if a "Y" was entered:

set net=N

inkey /K"YN" /w10 Load network (Y/N)?  %%net

iff "%net" == "Y" then

rem Commands to load the network go here

endiff

/X	(No carriage return) Prevents INKEY from adding a carriage return and line feed after the user's entry.


INPUT

Purpose:	Get a string from the keyboard and save it in an environment variable.

Format:	INPUT [/D /C /E /Ln /N /P /Wn /X] [prompt ] %%varname

prompt:  Optional text that is displayed as a prompt.

varname:  The variable that will hold the user's input.

/C(lear buffer)	/N(o color)

/D(igits only)	/P(assword)

/E(dit)	/W(ait)

/L(ength)	/X (no carriage return))

See also:  INKEY.

Usage

INPUT optionally displays a prompt.  Then it waits for a specified time or indefinitely for your entry.  It places any characters you type into an environment variable.  INPUT is normally used in batch files and aliases to get multi-key input.  Along with the INKEY command, INPUT allows great flexibility in reading user input from within a batch file or alias.

If prompt text is included in an INPUT command, it is displayed while INPUT waits for input.  Standard command-line editing keys may be used to edit the input string as it is entered.  If you use the /P password option, INPUT will echo asterisks instead of the keys you type.

All characters entered up to, but not including, the carriage return are stored in the variable.

The following batch file fragment prompts for a string and stores it in the variable FNAME:

input Enter the file name:  %%fname

INPUT reads standard input, so it will accept text from a re- directed file.

If you press Ctrl-C or Ctrl-Break while INPUT is waiting for input, execution of an alias will be terminated, and execution of a batch file will be suspended while you are asked whether to cancel the batch job.  In a batch file you can handle Ctrl-C and Ctrl-Break yourself with the ON BREAK command.

Options

/C	(Clear buffer) Clears the keyboard buffer before INPUT accepts keystrokes.  If you use this option, INPUT will ignore any keystrokes which you type, either accidentally or intentionally, before INPUT is ready.

/D	(Digits only): Prevents INPUT from accepting any keystrokes except digits from 0 to 9.

/E	(Edit) Allows you to edit an existing value.  If there is no existing value for varname, INPUT proceeds as if /E had not been used, and allows you to enter a new value.

/Ln	(Length) Sets the maximum number of characters which INPUT will accept to "n".  If you attempt to enter more than this number of characters, INPUT will beep and prevent further input (you will still be able to edit the characters typed before the limit was reached).

/N	(No color) Disables the display colors set by InputColor in the TCMD.INI file.  With this option, INPUT will use the default display colors instead.

/P	(Password) Tells INPUT to echo asterisks, instead of the characters you type.

/W	(Wait) Time-out period, in seconds, to wait for a response. If no keystroke is entered by the end of the time-out period, INPUT returns with the variable unchanged. If you enter a key before the time-out period, INPUT will wait indefinitely for the remainder of the line.  You can specify /W0 to return immediately if there are no keys waiting in the keyboard buffer.

/X	(No carriage return) Prevents INPUT from adding a carriage return and line feed after the user's entry.


KEYBD

Purpose:	Set the state of the keyboard toggles:  Caps Lock, Num Lock, and Scroll Lock.

Format:	KEYBD [/Cn /Nn /Sn]

n:  0 to turn off the toggle, or 1 to turn on the toggle.

/C(aps lock)	/S(croll lock)

/N(um lock)

Usage

Most keyboards have 3 toggle keys, the Caps Lock, Num Lock, and Scroll Lock.  The toggle key status is usually displayed by three lights at the top right corner of the keyboard.

This command lets you turn any toggle key on or off.  It is most useful in batch files and aliases if you want the keys set a particular way before collecting input from the user.

For example, to turn off the Num Lock and Caps Lock keys, you can use this command:

c:\> keybd /c0 /n0

If you use the KEYBD command with no switches, it will display the present state of the toggle keys.

In Windows, the toggle key state is the same for each session. Changes made with KEYBD will affect all other sessions.

Options

/C	(Caps lock) Turn the Caps Lock key on or off.

/N	(Num lock) Turn the Num Lock key on or off.

/S	(Scroll lock) Turn the Scroll Lock key on or off.


KEYSTACK

Purpose:	Feed keystrokes to a program or command automatically.

Format:	KEYSTACK [/Wn] ["abc"] [keyname] [!] ...

"abc":  Literal characters to be placed in the Keystack.

keyname:  Name for a key to be placed in the Keystack.

!:  Signal to clear the Keystack and the keyboard buffer.

/W(ait)

Usage

KEYSTACK takes a series of keystrokes and feeds them to a program or command as if they were typed at the keyboard.  When the program has used all of the keystrokes sent by KEYSTACK, it will begin to read the keyboard for input, as it normally would.

Characters entered within double quotes ("abc") will be stored "as is" in the buffer.  The only items allowed outside double quotes are key names and the ! and /W options.

See Keys and key names for a complete listing of key names and a description of the key name format.

An exclamation mark [!] will clear all pending keystrokes in the KEYSTACK buffer.

For example, to start Word for Windows version 2 and open the last document you worked on, you could use the command:

d:\doc> keystack F10 Right Down "1" ^ word

This places the keystrokes for F10 (change to the menu bar), right arrow (move to the File menu), down arrow (display the file menu), and "1" (open the most recently used file) into the buffer, then runs Word.  When Word starts it receives these keystrokes and performs the appropriate actions.

Due to limitations within Windows, you can not use KEYSTACK to pass "accelerator" keys for menus (accelerator keys are the underlined characters on certain menu options in Windows applications).  For example, in the example above you could not use KEYSTACK Alt-F to open the file menu.

You can store a maximum of 255 characters in the KEYSTACK buffer.  Each time the KEYSTACK command is executed, it will clear any remaining keystrokes stored by a previous KEYSTACK command.

KEYSTACK will send the keystrokes to the current active window.  If you want to send keystrokes to another program (rather than have them function with Take Command itself), you must start the program or ACTIVATE its window so it can receive the keystrokes.  You can do this before or after executing the KEYSTACK command.  The most reliable sequence is usually to activate the program's window first, then place the keystrokes in the buffer; this helps ensure that another application does not receive the keystrokes inadvertently.  (To do this in a batch file you must start the program with the START command.  If you start it directly -- without using START -- the batch file will wait for the application to complete before continuing and running the KEYSTACK command, and the keystrokes will be placed in the buffer too late.)

You may need to experiment with your programs and insert delays (see the /W option) to find the window activation and keystroke sequence that works for a particular program.

Options

/W	(Wait):  Delay the next keystroke in the KEYSTACK buffer by a specified number of clock "ticks".  A clock tick is approximately 1/18 second.  The number of clock ticks to delay should be placed immediately after the W, and must be between 1 and 65535 (65535 ticks is about 1 hour).  You can use the /W option as many times as desired and at any point in the string of keystrokes except within double quotes.  Some programs may need the delays provided by /W in order to receive keystrokes properly from KEYSTACK.  The only way to determine what delay is needed is to experiment.  For example, to start the program CADX and send it an F7, a delay of one second, and a carriage return:

c:\> keystack F7 /W18 Enter ^ cadx


LIST

Purpose:	Display a file, with forward and backward paging and scrolling.

Format:	LIST [/A[[:][-]rhsda] /H /S /W /X] file...

file:  A file or list of files to display.

/A(ttribute select)	/W(rap)

/H(igh bit off)	/X (heX display mode)

/S(tandard input)

See also:  TYPE.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

LIST provides a much faster and more flexible way to view a file than TYPE, without the overhead of loading and using a text editor.

LIST is most often used for displaying ASCII text files.  Most other files contain non-alphabetic characters and may be unreadable, except in hex mode.

For example, to display a file called MEMO.DOC:

c:\> list memo.doc

If the file argument is a directory name, LIST will display all files in the directory.

LIST uses the scroll bars or the cursor pad to scroll through the file.  You can select the LIST commands either with the mouse (on the button bar and scrollbars) or from the keyboard.  LIST recognizes the following keys and buttons:

Key	Button	Meaning

Home	Display the first page of the file.

End	Display the last page of the file.

Esc	Cont	Exit the current file.

Ctrl-C	Quit	Quit LIST.

↑	Scroll up one line.

↓	Scroll down one line.

←	Scroll left 8 columns.

→	Scroll right 8 columns.

Ctrl ←	Scroll left 40 columns.

Ctrl →	Scroll right 40 columns.

F1	Display online help.

B	Back	Back up to the previous file.

F	Find	Prompt and search for a string.  If you want to search by hex value, click on the "Hex search" radio button, and enter the values as one or two character hex values, separating each value by a space.  (For example, "41 2F 0D 0A".)  LIST remembers the search strings you have used in the current Take Command session; to select a previous string, use the drop-down arrow to the right of the string entry field.

G	Goto	Go to a specific line or byte position.

H	High	Toggle the "strip high bit" (/H) option.

I	Info	Display information on the current file (the full name, size, date, and time).

N	Next	Find next matching string.

O	Open	Open a new file.

P	Print	Print part of or the entire file.

W	Wrap	Toggle the "line wrap" (/W) option.

X	heX	Toggle the hex-mode display (/X) option.

Text searches performed with F and N are not case sensitive.  However, if the display is currently in hexadecimal mode and you press F, you will be prompted for whether you want to search in hexadecimal as well.  If you answer Y, you should then enter the search string as a sequence of 2-digit hexadecimal numbers separated by spaces, for example 41 63 65 (these are the ASCII values for the string "Ace").  Hexadecimal searches are case sensitive, and search for exactly the string you enter.

You can further increase the power of LIST's text searches by using Take Commands extended wildcards in the search string.  If you want to disable wildcard searches (perhaps to search for text that includes wildcard characters) start the search string with a single backquote character.  A trailing backquote at the end of the seach string is optional.

LIST saves the search string used by F and N, so you can LIST multiple files and search for the same string simply by pressing N in each file, or repeat your search the next time you use LIST.

LIST normally allows long lines in the file to extend past the right edge of the screen.  You can use the horizontal scrolling keys (see above) to view text that extends beyond the screen width.  If you use the W command or /W switch to wrap the display, each line is wrapped when it reaches the right edge of the screen, and the horizontal scrolling keys are disabled.

If you print the file which LIST is displaying, the print format will match the display format.  If you have switched to hexadecimal or wrapped mode, that mode will be used for the printed output as well.  If you print in wrapped mode, long lines will be wrapped at the width of the display.  If you print in normal display mode without line wrap, long lines will be wrapped or truncated by the printer, not by LIST.  Regardless of the display mode, LIST will ask whether you wish to print the current page or the entire file.

Most of the LIST keystrokes can be reassigned with key mapping directives in the .INI file .

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., LIST /A), LIST will select all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.

/H	(High bit off) Strip the high bit from each character before displaying.  This is useful when displaying files created by some word processors that turn on the high bit for formatting purposes.  You can toggle this option on and off from within LIST with the H key.

/S	(Standard input) Read from standard input rather than a file.  This allows you to redirect command output and view it with LIST.  For example, to use LIST to display the output of DIR:

c:\> dir | list /s

/W	(Wrap) Wrap the text at the right edge of the screen.  This option is useful when displaying files that don't have a carriage return at the end of each line.  The horizontal scrolling keys do not work when the display is wrapped.  You can toggle this option on and off from within LIST with the W key.

/X	(hex mode):  Display the file in hexadecimal (hex) mode. This option is useful when displaying executable files and other files that contain non-text characters.  Each byte of the file is shown as a pair of hex characters.  The corresponding text is displayed to the right of each line of hexadecimal data.  You can toggle this mode on and off from within LIST with the X key.


LOADBTM

Purpose:	Switch a batch file to or from BTM mode.

Format:	LOADBTM [ON | OFF]

Usage

Take Command recognizes two kinds of batch files: .BAT and .BTM.  Batch files executing in BTM mode run two to five times faster than in BAT mode.  Batch files automatically start in the mode indicated by their extension.

The LOADBTM command turns BTM mode on and off.  It can be used to switch modes in either a .BAT or .BTM file.  If you use LOADBTM with no argument, it will display the current batch mode:  LOADBTM ON or LOADBTM OFF.

LOADBTM can only be used within a batch file.  It is most often used to convert a.BAT file to BTM mode without changing its extension.

Using LOADBTM to repeatedly switch modes within a batch file is not efficient.  In most cases the speed gained by running some parts of the file in BTM mode will be more than offset by the speed lost through repeated loading of the file each time BTM mode is invoked.


LOG

Purpose:	Save a log of commands to a disk file.

Format:	LOG [/H /W file ] [ON | OFF | text ]

file:  The name of the file to hold the log.

text:  An optional message that will be added to the log.

/H(istory log)	/W(rite to).

See also:  HISTORY.

Usage

LOG keeps a record of all internal and external commands you use. Each entry includes the current system date and time, along with the actual command after any alias or variable expansion.  You can use the log file as a record of your daily activities.

LOG with the /H option keeps a similar record, but it does not record the date and time for each command.  In addition, it records commands before aliases and variables are expanded.

By default, LOG writes to the file TCMDLOG in the root directory of the boot drive.  The default file name for LOG /H is TCMDHLOG.

Entering LOG or LOG /H with no parameters displays the log status (ON or OFF) and the name of the LOG file:

c:\> log

LOG (C:\TCMDLOG) is OFF

To enable or disable logging, add the word "ON" or "OFF" after the LOG command:

c:\> log on

or

c:\> log /h on

Entering LOG or LOG /H with text writes a message to the log file, even if logging  is set OFF.  This allows you to enter headers in the log file:

c:\> log "Started work on the database system"

The LOG file format looks like this:

[mm-dd-yy  hh:mm:ss]  command

The LOG /H output can be used as the basis for writing batch files. Start LOG /H, then execute the commands that you want the batch file to execute.  When you are finished, turn LOG /H off.  The resulting file can be turned into a batch file that performs the same commands with little or no editing.

You can have both a regular log (with time and date stamping) and a history log (without the time stamps) enabled simultaneously.

Options

/H	(History log) This option turns on (or off) the history log, which saves commands without the time and date stamp.  For example, to turn on history logging and write to the file C:\LOG\HLOG:

c:\>  log /h /w c:\log\hlog

/W	(Write) This switch specifies a different filename for the LOG or LOG /H output.  It also automatically performs a LOG ON command.  For example, to turn logging on and write the log to C:\LOG\LOGFILE:

c:\> log /w c:\log\logfile

Once you select a new file name with the LOG /W or LOG /H/W command, LOG will use that file until you issue another LOG /W or LOG /H/W command, or until you reboot your computer.  Turning LOG or LOG /H off or on does not change the file name.  You can set the default log file names when Take Command starts with the LogName and HistLogName directives in the .INI file.


MD

Purpose:	Create a subdirectory.

Format:	MD [/S] pathname...

    or

MKDIR [/S] pathname...

pathname:  The name of one or more directories to create.

/S(ubdirectories)

See also:  RD.

Usage

MD and MKDIR are synonyms.  You can use either one.

MD creates a subdirectory anywhere in the directory tree.  To create a subdirectory from the root, start the pathname with a backslash [\].  For example, this command creates a subdirectory called MYDIR in the root directory:

c:\> md \mydir

If no path is given, the new subdirectory is created in the current directory.  This example creates a subdirectory called DIRTWO in the current directory:

c:\mydir> md dirtwo

To create a directory from the parent of the current directory (that is, to create a sibling of the current directory), start the pathname with two periods and a backslash [..\].

Option

/S	(Subdirectories) MD creates one directory at a time unless you use the /S option.  If you need to create the directory C:\ONE\TWO\THREE and none of the named directories exist, you can use /S to have MD create all of the necessary subdirectories for you in a single command:

c:\> md /s \one\two\three


MEMORY

Purpose:	Display the amount and status of system memory.

Format:	MEMORY

Usage

MEMORY lists the total and available physical RAM, the total and free environment and alias space, and the total history space.


MOVE

Purpose:	Move files to a new directory and drive.

Format:	MOVE  [/A[[:][-]rhsda] /C /D /H /M /N /P /Q /R /S /T /U /V] source...  destination

source:  A file or list of files to move.

destination:  The new location for the files.

/A(ttribute select)	/Q(uiet)

/C(hanged)	/R(eplace)

/D(irectory)	/S(ubdirectory tree)

/H(idden and system)	/T(otal)

/M(odified)	/U(pdate)

/N(othing)	/V(erify)

/P(rompt)

See also:  COPY and RENAME.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.  Date, time, or size ranges anywhere on the line apply to all source files.

Usage

The MOVE command moves one or more files from one directory to another, whether the directories are on the same drive or not.  It has the same effect as copying the files to a new location and then deleting the originals.  Like COPY and RENAME, MOVE works with single files, multiple files, and sets of files specified with an include list.

The simplest MOVE command moves a single source file to a new location and, optionally, gives it a new name.  These two examples both move one file from drive C: to the root directory on drive A:

c:\> move myfile.dat a:\

c:\> move myfile.dat a:\savefile.dat

In both cases, MYFILE.DAT is removed from drive C: after it has been copied to drive A:.  If a file called MYFILE.DAT in the first example, or SAVEFILE.DAT in the second example, already existed on drive A:, it would be overwritten.  (This demonstrates the difference between MOVE and RENAME.  MOVE will move files between drives and will overwrite the destination file if it exists; RENAME will not.)

If you MOVE multiple files, the destination must be a directory name.  MOVE will move each file into the destination directory with its original name (if the target is not a directory, MOVE will display an error message and exit):

c:\> move *.wks *.txt c:\finance\myfiles

You cannot move a file to a character device like the printer, or to itself.

When you move files to another directory, if you add a backslash [\] to the end of the destination name MOVE will display an error message if the name does not refer to an existing directory. You can use this feature to keep MOVE from treating a mistyped destination directory name as a file name, and attempting to move all source files to that name.  The /D option performs the same function but will also prompt to see if you want to create the destination directory if it doesn't exist.

Be careful when you use MOVE with the SELECT command.  If you SELECT multiple files and the target is not a directory (for example, because of a misspelling), MOVE will assume it is a file name.  In this case each file will be moved in turn to the target file, overwriting the previous file, and then the original will be erased before the next file is moved.  At the end of the command, all of the original files will have been erased and only the last file will exist as the target file.  You can avoid this problem by using square brackets with SELECT instead of parentheses (be sure that you don't allow the command line to get too long -- watch the character count in the upper left corner while you're selecting files).  MOVE will then receive one list of files to move instead of a series of individual filenames, and it will detect the error and halt.  You can also add a backslash [\] to the end of the destination name to ensure that it is the name of a subdirectory (see above).

MOVE first attempts to rename the file(s), which is the fastest way to move files between subdirectories on the same drive.  If that fails (the destination is on a different drive or already exists), MOVE will copy the file(s) and then delete the originals.

If MOVE must physically copy the files and delete the originals, rather than renaming them (see above), then some disk space may be freed on the source drive.  The free space may be the result of moving the files to another drive, or of overwriting a larger destination file with a smaller source file.  MOVE displays the amount of disk space recovered unless the /Q option is used (see below).  It does so by comparing the amount of free disk space before and after the MOVE command is executed.  However, this amount may be incorrect if you are using a deletion tracking system which stores deleted files in a hidden directory, or if, under a multitasking system, another program performs a file operation while the MOVE command is executed.

When physically copying files, MOVE preserves the hidden, system, and read-only attributes of the source files, and sets the archive attribute of the destination files.  However, if the files can be renamed, and no copying is required, then the source file attributes are not changed.

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., /A), MOVE will select all files including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.

/C	(Changed files) Move files only if the destination file exists and is older than the source (see also /U).  This option is useful for updating the files in one directory from those in another without moving any newly-created files.

/D	(Directory) Requires that the destination be a directory.  If the destination does not exist, MOVE will prompt to see if you want to create it. If the destination exists as a file, MOVE will fail with an "Access denied" error.  Use this option to avoid having MOVE accidentally interpret your destination name as a file name when it's really a mistyped directory name.

/H	(Hidden) Move all files, including hidden and system files.

/M	(Modified) Only moves files which have the archive attribute set.

/N	(Nothing) Do everything except actually move the file(s). This option is most useful for testing what a complex MOVE command will do.

/P	(Prompt) Prompt the user to confirm each move.  Your options at the prompt are explained in detail under Page and File Prompts.

/Q	(Quiet) Don't display filenames, the total number of files moved, or the amount of disk space recovered, if any.  This option is most often used in batch files. See also /T.

/R	(Replace) Prompt for a Y or N response before overwriting an existing destination file.

/S	(Subdirectories) Move an entire subdirectory tree to another location.  MOVE will attempt to create the destination directories if they don't exist, and will remove empty subdirectories after the move. When /D is used with /S, you will be prompted if the first destination directory does not exist, but subdirectories below that will be created automatically by MOVE.  If you attempt to use /S to move a subdirectory tree into part of itself, MOVE will display an error message and halt.

/T	(Total) Don't display filenames as they are moved, but display the total number of files deleted and the amount of free disk space recovered, if any.

/U	(Update) Move each source file only if it is newer than a matching destination file or if a matching destination file does not exist (also see /C).  This option is useful for moving new or changed files from one directory to another.

/V	(Verify) Verify each disk write when a file is moved from one drive to another.  This is the same as executing the VERIFY ON command, but is only active during the MOVE.  /V does not read back the file and compare its contents with what was written; it only verifies that the data written to disk is physically readable.


MSGBOX

Purpose:	Display a message box and return the user's response.

Format:	MSGBOX OK | OKCANCEL | YESNO | YESNOCANCEL ["title"] prompt

title: Text for the title bar of the message box.

prompt: Text that will appear inside the message box.

Usage

MSGBOX can display one of 4 kinds of message boxes and wait for the user's response.  You can use title and prompt to display any text you wish.  Take Command automatically sizes and locates the box on the screen.

The message box may have 1, 2, or 3 response buttons.  The command MSGBOX OK creates a single-button box; the user must simply acknowledge the prompt text.

The OKCANCEL and YESNO forms have 2 buttons each.  The YESNOCANCEL form has 3 buttons.  The button the user chooses is returned in the Take Command variable %_?.  Be sure to save the return value in another variable or test it immediately; the value of %_? changes with every internal command.

The following list shows the value returned for each possible selection:

Yes	10	No	11

OK	10	Cancel	12

If you exit the message box without selecting one of these options (for example, some message boxes allow you to exit by pressing Esc or double-clicking the close button), MSGBOX will set %_? to 0.  If there is an error in the MSGBOX command itself, %_? will be set to 1 for a syntax error or 2 for any other error.


ON

Purpose:	Execute a command in a batch file when a specific condition occurs.

Format:	ON BREAK [command ]

    or

ON ERROR [command ]

    or

ON ERRORMSG [command ]

Usage

ON can only by used in batch files.

ON sets a "watchdog" that remains in effect for the duration of the current batch file.  Whenever a BREAK or ERROR condition occurs after ON has been executed, the command is automatically executed.

ON BREAK will execute its command if the user presses Ctrl- C or Ctrl-Break.

ON ERROR will execute its command after any command processor or operating system error (including critical errors). That is, ON ERROR will detect errors such as a disk write error, and Take Command errors such as a COPY command that fails to copy any files, or the use of an unacceptable command option.  The normal error message is not displayed when ON ERROR is used.

ON ERRORMSG is the same as ON ERROR, but displays the usual error message before executing the command.  The additional information about ON ERROR below also applies to ON ERRORMSG.

ON BREAK and ON ERROR are independent of each other.  You can use either one, or both, in any batch file.

Each time ON BREAK or ON ERROR is used, it defines a new command to be executed for a break or error, and any old command is discarded.  If you use ON BREAK or ON ERROR with no following command, that type of error handling is disabled. Error handling is also automatically disabled when the batch file exits.

ON BREAK and ON ERROR only affect the current batch file.  If you CALL another batch file, the first batch file's error handling is suspended, and the CALLed file must define its own error handling. When control returns to the first batch file, its error handling is reactivated.

The command can be any command that can be used on a batch file line by itself.  Frequently, it is a GOTO or GOSUB command.  For example, the following fragment traps any user attempt to end the batch file by pressing Ctrl-C or Ctrl-Break.  It scolds the user for trying to end the batch file and then continues displaying the numbers from 1 to 1000:

on break gosub gotabreak

do i = 1 to 1000

echo %i

enddo

quit

:gotabreak

echo Hey!  Stop that!!

return

You can use a command group as the command if you want to execute multiple commands, for example:

on break (echo Oops, got a break! & quit)

ON BREAK and ON ERROR always assume that you want to continue executing the batch file.  After the command is executed, control automatically returns to the next command in the batch file (the command after the one that was interrupted by the break or error).  The only way to avoid continuing the batch file after a break or error is for the command to transfer control to another point with GOTO, end the batch file with QUIT or CANCEL, or start another batch file (without CALLing it).

When handling an error condition with ON ERROR, you may find it useful to use internal variables, particularly %_? and %_SYSERR, to help determine the cause of the error.

Caution:  If a break or error occurs while the command specified in ON BREAK or ON ERROR is executing, the command will be restarted. This means you must use caution to avoid or handle any possible errors in the commands invoked by ON ERROR, since such errors can cause an infinite loop.


PATH

Purpose:	Display or alter the list of directories that Take Command will search for executable files, batch files, and files with executable extensions that are not in the current directory.

Format:	PATH [directory [;directory...]]

directory:  The full name of a directory to include in the path setting.

See also:  ESET and SET.

Usage

When Take Command is asked to execute an external command (a .COM, .EXE, .BTM, or .BAT file, or an executable extension), it first looks for the file in the current directory. If it fails to find an executable file there, it then searches the \WINDOWS directory, the \WINDOWS\SYSTEM directory, and the directory which contains TCMD.EXE.  If it still hasn't found an executable file, Take Command will then search each of the directories specified in the PATH setting.

For example, after the following PATH command, Take Command will search for an executable file in seven directories:  the current directory, the two Windows directories, the TCMD.EXE directory, the root directory on drive C, then the DOS subdirectory on C, and then the UTIL subdirectory on C:

c:\> path c:\;c:\dos;c:\util

The list of directories to search is stored as an environment string, and can also be set or viewed with SET, and edited with ESET.

Directory names in the path must be separated by semicolons [;].  Each directory name is shifted to upper case to maintain compatibility with programs which can only recognize upper case directory names in the path.  If you modify your path with the SET or ESET command, you may include directory names in lower case.  These may cause trouble with some programs, which assume that all path entries have been shifted to upper case.

If you enter PATH with no parameters, the current path is displayed:

c:\> path

PATH=C:\;C:\DOS;C:\UTIL

Entering PATH and a semicolon clears the search path so that only the current directory is searched for executable files (this is the default at system startup).

Some applications also use the PATH to search for their data files.

If you include an explicit file extension on a command name (for example, WP.EXE ), the search will find files with that name and extension in the current directory and every directory in the path. It will not locate other executable files with the same base name.

If you have an entry in the path which consists of a single period [.], the current directory will not be searched first, but instead will be searched when Take Command reaches the "." in the path. This allows you to delay the search of the current directory for executable files and files with executable extensions.  In rare cases, this feature may not be compatible with applications which use the path to find their files; if you experience a problem, you will have to remove the "." from the path while using any such application.

To create a path longer than the command-line length limit, use PATH repeatedly to append additional directories to the path:

path [first list of directories]

path %path;[second list of directories]         ...

You cannot use this method to extend the path beyond 2042 characters (the internal buffer limit, with room for "PATH ").  It is usually more efficient to use aliases to load application programs than to create a long PATH.  See ALIAS for details.

If you specify an invalid directory in the path, it will be skipped and the search will continue with the next directory in the path.


PAUSE

Purpose:	Suspend batch file or alias execution.

Format:	PAUSE [text ]

text:  The message to be displayed as a user prompt.

Usage

A PAUSE command will suspend execution of a batch file or alias, giving you the opportunity to change disks, turn on the printer, etc.

PAUSE waits for any key to be pressed and then continues execution. You can specify the text that PAUSE displays while it waits for a keystroke, or let Take Command use the default message:

Press any key when ready...

For example, the following batch file fragment prompts the user before erasing files:

pause Press Ctrl-C to abort, any other key to erase all .LST files

erase *.lst

If you press Ctrl-C or Ctrl-Break while PAUSE is waiting for a key, execution of an alias will be terminated, and execution of a batch file will be suspended while you are asked whether to cancel the batch job.  In a batch file you can handle Ctrl-C and Ctrl-Break yourself with the ON BREAK command.


POPD

Purpose:	Return to the disk drive and directory at the top of the directory stack..

Format:	POPD [*]

See also:  DIRS and PUSHD.

Usage

Each time you use the PUSHD command, it saves the current disk drive and directory on the internal directory stack.  POPD restores the last drive and directory that was saved with PUSHD and removes that entry from the stack.  You can use these commands together to change directories, perform some work, and return to the starting drive and directory.

Directory changes made with POPD are recorded for display in the directory history window.

This example saves and changes the current disk drive and directory with PUSHD, and then restores it.  The current directory is shown in the prompt:

c:\> pushd d:\database\test

d:\database\test> popd

c:\>

You can use the DIRS command to see the complete list of saved drives and directories (the directory stack).

The POPD command followed by an asterisk [*] clears the directory stack without changing the current drive and directory.

If the directory on the top of the stack is not on the current drive, POPD will switch to the drive and directory on the top of the stack without changing the default directory on the current drive.


PROMPT

Purpose:	Change the command-line prompt.

Format:	PROMPT [text ]

text:  Text to be used as the new command-line prompt.

Usage

You can change and customize the command-line prompt at any time. The prompt can include normal text, and system information such as the current drive and directory, the time and date, and the amount of memory available.  You can create an informal "Hello, Bob!" prompt or an official-looking prompt full of impressive information. The prompt text can contain special commands in the form $?, where ? is one of the characters listed below:

b	The vertical bar character [|].

c	The open parenthesis [(].

d	Current date, in the format:  Fri  1-07-94 (the month, day, and year are formatted according to your current country settings).

D	Current date, in the format:  Fri  Jan 7, 1994.

e	The ASCII ESC character (decimal 27).

f	The close parenthesis [)].

g	The > character.

h	Backspace over the previous character.

l	The < character.

m	Display the time (hours and minutes) in 24-hour format.

M	Display the time (hours and minutes) in the default country format.

n	Current drive letter.

p	Current drive and directory (lower case).

P	Current drive and directory (upper case).

q	The = character.

r	The numeric exit code of the last external command.

s	The space character.

t	Current 24-hour time, in the format hh:mm:ss.

T	Current 12-hour time, in the format hh:mm:ss[a|p].

v	Operating system version number, in the format 3.10.

xd:	Current directory on drive d:, in lower case.

Xd:	Current directory on drive d:, in upper case.

z	Current shell nesting level.  The first copy of Take Command is shell level 0, and each subsequent copy increments the level by 1.

$	The $ character.

_	CR/LF (go to beginning of a new line).

For example, to set the prompt to the current date and time, with a ">" at the end:

c:\> prompt $d $t $g

Fri  Dec 2, 1994 10:29:19 >

To set the prompt to the current date and time, followed by the current drive and directory in upper case on the next line, with a ">" at the end:

c:\> prompt $d $t$_$P$g

Fri  Dec 2, 1994 10:29:19

[c:\]

To set the prompt to the current date and time, followed by the current drive and directory in upper case on the next line, surrounded by square brackets:

The Take Command prompt can be set in TCSTART, or in any batch file that runs when Take Command starts.  The Take Command default prompt is $n$g (drive name followed by ">") on floppy drives, and $p$g (current drive and directory followed by ">") on all other drives.

If you enter PROMPT with no arguments, the prompt will be reset to its default value.  The PROMPT command sets the environment variable PROMPT, so to view the current prompt setting use the command:

c:\> set prompt

(If the prompt is not set at all, the PROMPT environment variable will not be used, in which case the SET command above will give a "Not in environment" error.)

Along with literal text and special characters you can include the text of any environment variable, internal variable, or variable function in a prompt.  For example, if you want to include the size of the largest free memory block in the command prompt, plus the current drive and directory, you could use this command:

c:\> prompt (%%@dosmem[K]K) $p$g

(601K) c:\data>

Notice that the @DOSMEM function is shown with two leading percent signs [%].  If you used only one percent sign, the @DOSMEM function would be expanded once when the PROMPT command was executed, instead of every time the prompt is displayed.  As a result, the amount of memory would never change from the value it had when you entered the PROMPT command.  You can also use back quotes to delay expanding the variable function until the prompt is displayed:

c:\> prompt `(%@dosmem[K]K) $p$g`


PUSHD

Purpose:	Save the current disk drive and directory, optionally changing to a new drive and directory.

Format:	PUSHD [pathname ]

pathname:  The name of the new default drive and directory.

See also:  DIRS, POPD and the CDPATH environment variable.

Usage

PUSHD saves the current drive and directory on a "last in, first out" directory stack.  The POPD command returns to the last drive and directory that was saved by PUSHD.  You can use these commands together to change directories, perform some work, and return to the starting drive and directory.  The DIRS command displays the contents of the directory stack.

To save the current drive and directory, without changing directories, use the PUSHD command by itself, with no pathname.

If a pathname is specified as part of the PUSHD command, the current drive and directory are saved and PUSHD changes to the specified drive and directory.  If the pathname includes a drive letter, PUSHD changes to the specified directory on the new drive without changing the current directory on the original drive.

This example saves the current directory and changes to C:\WORDP\MEMOS, then returns to the original directory:

c:\> pushd \wordp\memos

c:\wordp\memos> popd

c:\>

Directory changes made with PUSHD are recorded for display in the directory history window.

The directory stack can hold up to 255 characters, or about 10 to 20 entries (depending on the length of the names).  If you exceed this limit, the oldest entry is removed before adding a new entry.

If PUSHD can't change directly to the specified directory, it will look for the CDPATH variable; see CDPATH for details.


QUERYBOX

Purpose:	Display a query in a dialog box, and return the string value entered.

Format:	QUERYBOX /E /Ln ["title"] prompt %%var

title: Text for the title bar of the message box.

prompt: Text that will appear inside the message box.

%%var : Variable name where the input will be saved.

/E(dit existing value)	/L (maximum length)

Usage

QUERYBOX is similar to INPUT, except that it appears as a popup dialog box.


QUIT

Purpose:	Terminate the current batch file.

Format:	QUIT [value ]

value:  The exit code from 0 to 255 to return to Take Command or to the previous batch file.

See also:  CANCEL.

Usage

QUIT provides a simple way to exit a batch file before reaching the end of the file.  If you QUIT a batch file called from another batch file, you will be returned to the previous file at the line following the original CALL.

QUIT only ends the current batch file.  To end all batch file processing, use the CANCEL command.

If you specify a value, QUIT will set the ERRORLEVEL or exit code (see the IF command, and the %? variable) to that value.

You can also use QUIT to terminate an alias.  If you QUIT an alias while inside a batch file, QUIT will end both the alias and the batch file and return you to the command prompt or to the calling batch file.


RD

Purpose:	Remove one or more subdirectories.

Format:	RD pathname ...

    or

RMDIR pathname ...

pathname:  The name of a subdirectory to remove.

See also:  MD.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

RD and RMDIR are synonyms.  You can use either one.

RD removes directories from the directory tree.  For example, to remove the subdirectory MEMOS from the subdirectory WP, you can use this command:

c:\> rd \wp\memos

Before using RD, you must delete all files and subdirectories (and their files) in the pathname you want to remove.  Remember to remove hidden and read-only files as well as normal files (you can use DEL /Z to delete hidden and read-only files).

You can use wildcards in the pathname.

You cannot remove the root directory, the current directory (.), any directory above the current directory in the directory tree, or any directory in use by another process in a multitasking system.


REBOOT

Purpose:	Do a system reboot.

Format:	REBOOT [/R /V]

/R(estart)	/V(erify)

Usage

REBOOT will restart Windows or completely restart your computer.  It normally performs a warm reboot, which is comparable to pressing Ctrl-Alt-Delete.  The following example prompts you to verify the reboot, then does a warm boot:

c:\> reboot /v

REBOOT defaults to performing a warm boot, with no prompting.

REBOOT flushes the disk buffers, resets the drives, and waits one second before rebooting, to allow disk caching programs to finish writing any cached data.  Take Command issues the proper commands to shut down Windows before rebooting.

Options

/R	(Restart) Restart Windows, but do not reboot the computer.

/V	(Verify) Prompt for confirmation (Y or N) before rebooting.


REM

Purpose:	Put a comment in a batch file.

Format:	REM [comment ]

comment:  The text to include in the batch file.

Usage

The REM command lets you place a remark or comment in a batch file. Batch file comments are useful for documenting the purpose of a batch file and the procedures you have used.

REM must be followed by a space or tab character and then your comment.  Comment lines can be up to 255 characters long.  Take Command will normally ignore everything on the line after the REM command, including quote characters, redirection symbols, and other commands (see below for the exception to this rule).

If ECHO is ON, the comment is displayed.  Otherwise, it is ignored. If ECHO is ON and you don't want to display the line, preface the REM command with an at sign [@].

You can use REM to create a zero-byte file if you use a redirection symbol immediately after the REM command.  For example, to create the zero-byte file C:\FOO:

c:\> rem>foo

(This capability is included for compatibility with traditional command processors.  A simpler method for creating a zero-byte file with Take Command is to enter  >filename as a command, with no actual command before the [>] redirection character.)


REN
REN / RENAME

Purpose:	Rename files or subdirectories.

Format:	REN [/A[[:][-]rhsda] /N /P /Q /S /T] old_name... new_name

    or

RENAME [/A[[:][-]rhsda] /N /P /Q /S /T] old_name... new_name

old_name:  Original name of the file(s) or subdirectory.

new_name:  New name to use, or new path on the same drive.

/A(ttribute select)	/Q(uiet)

/N(othing)	/S(ubdirectory)

/P(rompt)	/T(otal)

See also:  COPY and MOVE.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

REN and RENAME are synonyms.  You may use either one.

REN lets you change the name of a file or a subdirectory, or move one or more files to a new subdirectory on the same drive.  (If you want to move files to a different drive, use MOVE.)

In its simplest form, you simply give REN the old_name of an existing file or subdirectory and then a new_name.  The new_name must not already exist -- you can't give two files the same name (unless they are in different directories).  The first example renames the file MEMO.TXT to MEM.TXT.  The second example changes the name of the \WORD directory to \WP:

c:\> rename memo.txt mem.txt

c:\> rename \word \wp

You can also use REN to rename a group of files that you specify with wildcards, as multiple files, or in an include list.  When you do, the new_name must use one or more wildcards to show what part of each filename to change.  Both of the next two examples change the extensions of multiple files to .SAV:

c:\> ren config.nt autoexec.nt tcstart.btm *.sav

c:\> ren *.txt *.sav

REN can move files to a different subdirectory on the same drive. When it is used for this purpose, REN requires one or more filenames for the old_name and a directory name for the new_name:

c:\> ren memo.txt \wp\memos\

c:\> ren oct.dat nov.dat \data\save\

The final backslash in the last two examples is optional.  If you use it, you force REN to recognize the last argument as the name of a directory, not a file.  The advantage of this approach is that if you accidentally mistype the directory name, REN will report an error instead of renaming your files in a way that you didn't intend.

Finally, REN can move files to a new directory and change their name at the same time if you specify both a path and file name for new_name.  In this example, the files are renamed with an extension of .SAV as they are moved to a new directory:

c:\> ren *.dat \data\save\*.sav

When new_name refers to a file or files (rather than a directory), the file(s) must not already exist.  Also, you cannot rename a subdirectory to a new location on the directory tree.

REN does not change a file's attributes.  The new_name file(s) will have the same attributes as old_name.

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., /A), REN will rename all files including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.

/N	(Nothing) Do everything except actually rename the file(s). This option is useful for testing what a REN command will actually do.

/P	(Prompt) Prompt the user to confirm each rename operation. Your options at the prompt are explained in detail under Page and File Prompts.

/Q	(Quiet) Don't display filenames  or the number of files renamed.  This option is most often used in batch files.  See also /T.

/S	(Subdirectory) Normally, you can rename a subdirectory only if you do not use any wildcards in the new_name.  This prevents subdirectories from being renamed inadvertently when a group of files is being renamed with wildcards.  /S will let you rename a subdirectory even when you use wildcards.

/T	(Total) Don't display filenames as they are renamed, but report the number of files renamed.  See also /Q.


RETURN

Purpose:	Return from a GOSUB (subroutine) in a batch file.

Format:	RETURN

See also:  GOSUB.

Usage

Take Command allows subroutines in batch files.

A subroutine begins with a label (a colon followed by a word) and ends with a RETURN command.

The subroutine is invoked with a GOSUB command from another part of the batch file.  When a RETURN command is encountered the subroutine terminates, and execution of the batch file continues on the line following the original GOSUB.

The following batch file fragment calls a subroutine which displays the files in the current directory:

echo Calling a subroutine

gosub subr1

echo Returned from the subroutine

quit

:subr1

dir /a/w

return


SCREEN

Purpose:	Position the cursor on the screen and optionally display a message.

Format:	SCREEN row column [text ]

row:  The new row location for the cursor.

column:  The new column location for the cursor.

text:  Optional text to display at the new cursor location.

See also:  ECHO, SCRPUT, TEXT, and VSCRPUT.

Usage

SCREEN allows you to create attractive screen displays in batch files.  You use it to specify where a message will appear on the screen.  You can use SCREEN to create menu displays, logos, etc. The following batch file fragment displays a menu:

@echo off

cls

screen 3 10 Select a number from 1 to 4:

screen 6 20  1 - Word Processing         ...

SCREEN does not change the screen colors.  To display text in specific colors, use SCRPUT or VSCRPUT.  SCREEN always leaves the cursor at the end of the displayed text.

The row and column values are zero-based, so on a standard 25 line by 80 column display, valid rows are 0 - 24 and valid columns are 0 - 79.  You can also specify the row and column as offsets from the current cursor position.  Begin the value with a plus sign [+] to move the cursor down the specified number of rows or to the right the specified number of columns, or with a minus sign [-] to move the cursor up or to the left.  This example prints a string 3 lines above the current position, in absolute column 10:

screen -3 10 Hello, World!

SCREEN checks for a valid row and column, and displays a "Usage" error message if either value is out of range.


SCRPUT

Purpose:	Position text on the screen and display it in color.

Format:	SCRPUT row col [BRIght] fg ON BRIght] bg text

row:  Starting row

col:  Starting column

fg:  Foreground character color

bg:  Background character color

text:  The text to display

See also:  CLS, ECHO, SCREEN, TEXT, and VSCRPUT.

Usage

SCRPUT allows you to create attractive screen displays in batch files.  You use it to specify where a message will appear on the screen and what colors will be used to display the message text. You can use SCRPUT to create menu displays, logos, etc.

SCRPUT works like SCREEN, but allows you to specify the display colors.  It always leaves the cursor in its current position.

The row and column are zero-based, so on a standard 25 line by 80 column display, valid rows are 0 - 24 and valid columns are 0 - 79.  You can also specify the row and column as offsets from the current cursor position.  Begin the value with a plus sign [+] to move down the specified number of rows or to the right the specified number of columns, or with a minus sign [-] to move up or to the left.

The following batch file fragment displays part of a menu, in color:

cls white on blue

scrput 6 20 bri red on blu 1 - Word Processing

scrput 7 20 bri yel on blu 2 - Spreadsheet


SELECT

Purpose:	Interactively select files for a command.

Format:	SELECT [/A[:][-]rhsda /E /H /I"text" /O[:][-]adeginrsu /Z] [command ] ...(files...)...

command:  The command to execute with the selected files.

files:  The files from which to select.  File names may be enclosed in either parentheses or square brackets.  The difference is explained below.

/A(ttribute select)	/I (match descriptions)

/E (use upper case)	/O(rder)

/H(ide dots)	/Z (use FAT format)

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists. Date, time, or size ranges must appear immediately after the SELECT keyword.

Usage

SELECT allows you to select files for internal and external commands by using a full-screen "point and shoot" display.  You can have SELECT execute a command once for each file you select, or have it create a list of files for a command to work with.  The command can be an internal command, an alias, an external command, or a batch file.

If you use parentheses around the files, SELECT executes the command once for each file you have selected.  During each execution, one of the selected files is passed to the command as an argument.  If you use square brackets around files, the SELECTed files are combined into a single list, separated by spaces.  The command is then executed once with the entire list presented as its command-line arguments.

You can scroll through the SELECT list with the scrollbars or with the keyboard.  SELECT uses the cursor up, cursor down, cursor left, cursor right, PgUp, and PgDn keys to scroll through the files matching the argument(s).  Click on a line to select or deselect it, or use the + key or space bar to select a file, and the - key to unselect a file.  The "Toggle" button or * key will reverse all of the current marks (excluding subdirectories), and the "Clear" button or / key will unmark everything.  After marking the files, click on "Go" or press ENTER to execute the command.  You can select a single file by moving the scroll bar to the filename and selecting "Go" or pressing ENTER.

To skip the files listed in the current display and go on to the next file specification inside the parentheses or brackets (if any), press the Esc key.  To cancel the current SELECT command entirely, click on "Quit", or type an Escape, ^C, or ^BREAK.

In the simplest form of SELECT, you merely specify the command and then the list of files from which you will make your selection(s). For example:

c:\> select copy (*.com *.exe) a:\

will let you select from among the .COM and .EXE files on the current drive.  It will then invoke the COPY command to copy each file you select to drive A:.  You will be able to select first from a list of all .COM files in the current directory, and then from a list of all .EXE files.

If you want to select from a list of all the .COM and .EXE files mixed together, create an include list inside the parentheses by inserting a semicolon:

c:\> select copy (*.com;*.exe) a:\

Finally, if you want the SELECT command to send a single list of files to COPY, instead of invoking COPY once for each file you select, put the file names in square brackets instead of parentheses:

c:\> select copy [*.com;*.exe] a:\

If you use brackets, you have to be sure that the resulting command (the word COPY, the list of files, and the destination drive in this example) is no more than 1,023 characters long.  The current line length is displayed by SELECT while you are marking files to help you to conform to this limit.

The parentheses or brackets enclosing the file name(s) can appear anywhere within the command; SELECT assumes that the first set of parentheses or brackets it finds is the one containing the list of files from which you wish to make your selection.

The list of files from which you wish to select can be further refined by using date, time, and size ranges.  The range must be placed immediately after the word SELECT.  If the command is an internal command that supports ranges, an independent range can also be used in the command itself.

If you don't specify a command, the selected filename(s) will become the command.  For example, this command defines an alias called UTILS that selects from the executable files in the directory C:\UTIL, and then executes them in the order marked:

c:\> alias utils select (c:\util\*.com;*.exe;*.btm;*.bat)

If you want to use filename completion to enter the filenames inside the parentheses, type a space after the opening parenthesis.  Otherwise the command-line editor will treat the open parenthesis as the first character of the filename.

When displaying descriptions, SELECT adds a right arrow at the end of the line if the description is too long to fit on the screen.  This symbol will alert you to the existence of additional description text.

With the /I option, you can select files based on their descriptions.  SELECT will display files if their description matches the text after the /I switch.  The search is not case sensitive.  You can use wildcards and extended wild cards as part of the text.

When sorting file names and extensions for the SELECT display, Take Command normally assumes that sequences of digits should be sorted numerically (for example, the file DRAW2 would come before DRAW03 because 2 is numerically smaller than 03), rather than strictly alphabetically (where DRAW2 would come second because "2" comes after "0").  You can defeat this behavior and force a strict alphabetic sort with the /O:a option.

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is optional.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., SELECT /A ...), SELECT will display all files and subdirectories including hidden and system files. If attributes are combined, all the specified attributes must match for a file to be included in the listing.  For example, /A:RHS will display only those files with all three attributes set.

/E	Display filenames in upper case; also see SETDOS /U and the UpperCase directive in TCMD.INI.

/H	(Hide dots)  Suppress the display of the "." and ".." directories.

/I	(match descriptions)  Display filenames by matching text in their descriptions.  The text can include wild cards and extended wildcards.  The search text must be enclosed in quotation marks.  /I will be ignored if /C or /O:c is also used.

/O	(Order)  Set the sort order for the files.  The order can be any combination of the following options:

-	Reverse the sort order for the next option

a	Sort in ASCII order, not numerically, when there are digits in the name

d	Sort by date and time (oldest first).

e	Sort by extension

g	Group subdirectories first, then files

i	Sort by file description

n	Sort by filename (this is the default)

r	Reverse the sort order for all options

s	Sort by size

u	Unsorted

/Z	Display filenames in FAT format.  Long names will be truncated to 12 characters.  If the name is longer than 12 characters, it will be followed by a right arrow to show that one or more characters have been truncated.


SET

Purpose:	Display, create, modify, or delete environment variables.

Format:	SET [/P /R filename...] [name =][value ]]

filename:  The name of a file containing variable definitions.

name:  The name of the environment variable to define or modify.

value:  The new value for the variable.

/P(ause)	/R(ead from file)

See also:  ESET and UNSET.

Usage

Every program and command inherits an environment, which is a list of variable names, each of which is followed by an equal sign and some text.  Many programs use entries in the environment to modify their own actions.

If you simply type the SET command with no options or arguments, it will display all the names and values currently stored in the environment.  Typically, you will see an entry called PATH, an entry called CMDLINE, and whatever other environment variables you and your programs have established:

c:\> set

PATH=C:\;C:\OS2;C:\OS2\SYSTEM;C:\UTIL

CMDLINE=C:\Take Command\TCSTART.CMD

To add a variable to the environment, type SET, a space, the variable name, an equal sign, and the text:

c:\> set mine=c:\finance\myfiles

The variable name is converted to upper case by Take Command.  The text after the equal sign will be left just as you entered it.  If the variable already exists, its value will be replaced with the new text that you entered.

Normally you should not put a space on either side of the equal sign.  A space before the equal sign will become part of the name ; a space after the equal sign will become part of the value.

If you use SET to create a variable with the same name as one of the Take Command internal variables, you will disable the internal variable.  If you later execute a batch file or alias that depends on that internal variable, it may not operate correctly.

To display the contents of a single variable, type SET plus the variable name:

c:\> set mine

You can edit environment variables with the ESET command.  To remove variables from the environment, use UNSET, or type SET plus a variable name and an equal sign:

c:\> set mine=

The variable name is limited to a maximum of 80 characters. The name and value together cannot be longer than 1,023 characters.

In Take Command the size of the environment is set automatically, and increased as necessary as you add variables.

Options

/P	(Pause) Wait for a key to be pressed after each screen page before continuing the display.  Your options at the prompt are explained in detail under Page and File Prompts.

/R	(Read) Read environment variables from a file.  This is much faster than loading variables from a batch file with multiple SET commands.  Each entry in the file must fit within the 1,023-byte command-line length limit for Take Command:  The file is in the same format as the SET display, so SET /R can accept as input a file generated by redirecting SET output.  For example, the following commands will save the environment variables to a file, and then reload them from that file:

set > varlist

set /r varlist

You can load variables from multiple files by listing the filenames individually after the /R. You can add comments to a variable file by starting the comment line with a colon [:].

If you are creating a SET /R file by hand, and need to create an entry that spans multiple lines in the file, you can do so by terminating each line, except the last, with an escape character. However, you cannot use this method to exceed the command-line length limit.


SETDOS

Purpose:	Display or set the Take Command configuration.

Format:	SETDOS [/C? /D /E? /Fn.n /I+|- command /M? /N? /P? /R? S?:? /U? /V? /X[+|-]n /Y]

/C(ompound)	/P(arameter character)

/D(escriptions)	/S(hape of cursor)

/E(scape character)	/U(pper case)

/F(ormat for @EVAL)	/V(erbose)

/I(nternal commands)	/X (expansion, special characters)

/M(ode for editing)	/Y (single step)

/N(o clobber)

Usage

SETDOS allows you to customize certain aspects of Take Command to suit your personal tastes or the configuration of your system.  Each of these options is described below.

You can display the value of all SETDOS options by entering the SETDOS command with no parameters.

Most of the SETDOS options can be initialized when Take Command executes the configuration directives in the .INI file, and can also be changed from the configuration dialogs.. The name of the corresponding directive is listed with each option below; if none is listed, that option cannot be set from the .INI file.  You can also define the SETDOS options in your TCSTART or other startup file (see Automatic Batch Files), in aliases, or at the command line.

Options

/C	(Compound character) The COMPOUND option sets the character used for separating multiple commands on the same line.  The default is the caret [^]. You cannot use any of the redirection characters (| > <), or the blank, tab, comma, or equal sign as the command separator.  This example changes the COMPOUND character to a tilde [~]:

c:\> setdos /c~

If you want to share batch files or aliases between Take Command and our products for OS/2 and Windows NT, see the %+ variable, which retrieves the current command separator, and 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for details on using compatible command separators for all the products you use.  Also see the CommandSep directive.

/D	(Descriptions) The DESCRIPTIONS option controls whether file processing commands like COPY, DEL, MOVE, and REN process file descriptions along with the files they belong to.  /D1 turns description processing on, which is the default.  /D0 turns description processing off.  Also see the Descriptions directive.

You can also use /D to change the description file name, by placing the new name (rather than a 0 or 1), in double quotes, immediately after the /D.  Use this option with caution, because changing the name from the default will make it difficult to transfer file descriptions to another system.  Also see the DescriptionName directive.

/E	(Escape character) The ESCAPE option sets the character used to suppress the normal meaning of the following character.  Any character following the escape character will be passed unmodified to the command.  The default escape character for Take Command is a Ctrl-X; for Take Command 32 it is a caret [^]. You cannot use any of the redirection characters (| > <) or the blank, tab, comma, or equal sign as the escape character. Certain characters (b, c, e, f, n, r, s, and t) have special meanings when immediately preceded by the escape character.

If you want to share batch files or aliases between 4DOS, 4OS2, 4DOS/NT,  and Take Command, see the %= variable, which retrieves the current escape character, and 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for details on using compatible escape characters for all the products you use.  Also see the EscapeChar directive.

/F	(Format for @EVAL) The FORMAT option lets you set default decimal precision for the @EVAL variable function. The maximum precision is 16 digits to the left of the decimal point and up to 8 digits to the right of the decimal point.  By default, the minimum precision to the right of the decimal point is 0.  You can set both the minimum and maximum number of digits to the right of the decimal point with the FORMAT option.

The general form of this option is /Fx.y, where the x value sets the minimum number of digits to the right of the decimal place and the y value sets the maximum number of digits.  Both values can range from 0 to 8; if x is greater than y, it is ignored.  You can specify either or both values:  /F2.5, /F2, and /F.5 are all valid entries.  See the EvalMax and EvalMin directives to set the precision when Take Command starts; see the @EVAL function if you want to set the precision for a single computation.

/I	(Internal) The INTERNAL option allows you to disable or enable internal commands.  To disable a command, precede the command name with a minus [-].  To re-enable a command, precede it with a plus [+]. For example, to disable the internal LIST command to force Take Command to use an external command:

c:\> setdos /i-list

/M	(Mode) The MODE option controls the initial line editing mode.  To start in overstrike mode at the beginning of each command line, use /M0 (the default).  To start in insert mode, use /M1.  Also see the EditMode directive.

/N	(No clobber) The NOCLOBBER option controls output redirection).  /N0 means existing files will be overwritten by output redirection (with >) and that appending (with >>) does not require the file to exist already.  This is the default.  /N1 means existing files may not be overwritten by output redirection, and that when appending the output file must exist.  A /N1 setting can be overridden with the [!] character.  If you use /N1, you may have problems with a few unusual programs that shell out to run a command with redirection, and expect to be able to overwrite an existing file.  Also see the NoClobber directive.

/P	(Parameter character) This option sets the character used after a percent sign to specify all or all remaining command-line arguments in a batch file or alias (e.g., %& or %n&). The default for Take Command is the ampersand [&] for Take Command/32 it is the dollar sign [$].

If you want to share batch files or aliases between 4DOS, 4OS2, 4DOS/NT, and Take Command, see 4DOS, 4OS2, 4DOS/NT and Take Command Compatibility for details on selecting compatible parameter characters for all the products you use.  Also see the ParameterChar directive.

/S	(Shape) The SHAPE option sets the cursor width.  The format is /So:i where o is the width for overstrike mode, and i is the width for insert mode.  The width is entered as a percentage of the total character width.  The default values are 100:15 (a 100% or block cursor for overstrike mode, and a 15% or thin line cursor for insert mode).  Because of the way video drivers remap the cursor shape, you may not get a smooth progression in the cursor size from 0% - 100%.  To disable the cursor, enter /S0:0.  To prevent all cursor modification, enter /S-1:-1.  Also see the CursorOver and CursorIns directives.

/U	(Upper) The UPPER option controls the default case (upper or lower) for filenames displayed by internal commands like COPY and DIR.  /U0 displays file names in lower case (the default).  /U1 displays file names in the traditional upper case.  Also see the UpperCase directive.

/V	(Verbose) The VERBOSE option controls the default for command echoing in batch files.  /V0 disables echoing of batch file commands unless ECHO is explicitly set ON.  /V1, the default setting, enables echoing of batch file commands unless ECHO is explicitly set OFF.  Also see the BatchEcho directive.

/V2 forces echoing of all batch file commands, even if ECHO is set OFF or the line begins with an "@".  This allows you to turn echoing on for a batch file without editing the batch file and removing the ECHO OFF command(s) within it.  /V2 is intended for debugging, and can be set with SETDOS, but not with the BatchEcho directive in TCMD.INI.

/X[+|-]n	(expansion and special characters): This option enables and disables alias and environment variable expansion, and controls whether special characters have their usual meaning or are treated as text.  It is most often used in batch files to process text strings which may contain special characters.

The features enabled or disabled by /X are numbered.  All features are enabled when Take Command starts, and you can re-enable all features at any time by using /X0.  To disable a particular feature, use /X-n, where n is the feature number from the list below.  To re-enable the feature, use /X+n.  To enable or disable multiple individual features, list their numbers in sequence after the + or - (e.g. /X- 345 to disable features 3, 4, and 5).

The features are:

1	All alias expansion

2	Nested alias expansion only

3	All variable expansion (environment variables and batch and alias parameters)

4	Nested variable expansion only

5	Multiple commands, conditional commands, and piping

6	Redirection

7	Quoting (double quotes and back quotes) and square brackets

8	Escape character

If nested alias expansion is disabled, the first alias of a command is expanded but any aliases it invokes are not expanded.  If nested variable expansion is disabled, each variable is expanded once, but variables containing the names of other variables are not expanded further.

For example, to disable all features except alias expansion while you are processing a text file containing special characters:

setdos /x-35678

... [perform text processing here]

setdos /x0

/Y	(Single step) /Y1 enables single-stepping through a batch file.  Each command is displayed on the screen along with a Y/N/R (yes / no / remainder) prompt.  Press Y to execute the command, N to omit the command and go on to the next, or R or Esc to execute the remainder of the batch file (up to the next SETDOS /Y1 command).  You may also press Ctrl-C or Ctrl-Break to terminate the batch file.

Batch file single stepping is disabled each time Take Command returns to the command prompt. This means you cannot enter the SETDOS /Y1 command at the prompt, press Enter, and start a batch file in single step mode at the next prompt.  However you can enable single step operation and run a batch file from the prompt if you enter both commands on one line. For example, this command runs FILECOMP.BTM with single step enabled:

c:\> setdos /y1 & filecomp.btm


SETLOCAL

Purpose:	Save a copy of the current disk drive, directory, environment, and alias list.

Format:	SETLOCAL

See also:  ENDLOCAL.

Usage

SETLOCAL is used in batch files to save the default disk drive and directory, the environment, and the alias list to a reserved block of memory.  You can then change their values and later restore the original values with the ENDLOCAL command.

For example, this batch file fragment saves everything, removes all aliases so that user aliases will not affect batch file commands, changes the disk and directory, modifies a variable, runs a program, and then restores the original values:

setlocal

unalias *

cdd d:\test

set path=c:\;c:\dos;c:\util

rem run some program here

endlocal

SETLOCAL and ENDLOCAL are not nestable within a batch file. However, you can have multiple SETLOCAL / ENDLOCAL pairs within a batch file, and nested batch files can each have their own SETLOCAL / ENDLOCAL.  You cannot use SETLOCAL in an alias or at the command line.

An ENDLOCAL is performed automatically at the end of a batch file if you forget to do so.  If you invoke one batch file from another without using CALL, the first batch file is terminated, and an automatic ENDLOCAL is performed.  The second batch file inherits the drive, directory, aliases, and environment variables as they were prior to any unterminated SETLOCAL.


SHIFT

Purpose:	Allows the use of more than 127 parameters in a batch file.

Format:	SHIFT [n ]

n:  Number of positions to shift.

Usage

SHIFT is provided for compatibility with older batch files, where it was used to access more than 10 parameters.  Take Command supports 128 parameters (%0 to %127), so you may not need to use SHIFT for batch files running exclusively under JP Software command processors.

SHIFT moves each of the batch file parameters n positions to the left.  The default value for n is 1.  SHIFT 1 moves the parameter in %1 to position %0, the parameter in %2 becomes %1, etc.  You can reverse a SHIFT by giving a negative value for n (i.e., after SHIFT -1, the former %0 is restored, %0 becomes %1, %1 becomes %2, etc.).

SHIFT also affects the parameters %n$. (command-line tail) and %# (number of command arguments).


START

Purpose:	Start a program in another session or window.

Format:	START [/C /CM /Dpath /E /EXIT /INV /K /MAX /MIN /WAIT] [command ]

program title:  Title to appear on title bar.

path:  Startup directory.

progname:  Program name (not the session name).

command:  Command to be executed.

/C(lose when done)	/K(eep when done)

/CM (Caveman)	/MAX(imized)

/D(irectory)	/MIN(imized)

/E(nvironment)	/PGM (program name)

/EXIT (exit Windows)	/WAIT (for session to finish)

/INV(isible)

Usage

START is used to begin a new Windows session, and optionally run a program in that session.  If you use START with no parameters, it will begin a new command-line session.  If you add a command, START will begin a new session or window and execute that command.

START will return to the Take Command prompt immediately (or continue a batch file), without waiting for the progrqam to complete, unless you use /CM or /WAIT.

/MAX and /MIN allow you to start a character-mode windowed session in a maximized or minimized window.  The default is to let the operating environment choose the position and size of the window.

/C allows you to close the session when the command is finished (the default for Windows Presentation graphical sessions); /K allows you to keep the session open and go to a prompt (the default for Windows character mode sessions).

Options

/C	(Close) The session or window is closed when the application ends.

/CM	(Caveman) Run a DOS application under Caveman.  Use this option to force a DOS application to run under Caveman even if Caveman is not the default method for starting DOS programs.  For more details see Take Command and DOS Applications.  /CM will be ignored if Caveman is not loaded.

/D	(Directory)  Specifies the startup directory.  Include the directory name immediately after the /D, with no intervening spaces or punctuation.  Due to limitations in the way Windows starts DOS programs, /D is ignored when starting DOS applications.

/E	(Environment)  Specifies that a Windows application should receive Take Command's version of the environment, not the environment that was active when Windows was started.  By default, all applications receive a copy of the Windows startup environment and not any changes that were made by Take Command.  DOS applications that are run under Caveman always receive Take Command's version of the environment; those that are run with the START command always receive the Windows startup environment regardless of whether you use the /E switch.

A bug in Windows sometimes prevents an application from starting when you use the /E option.  You can sometimes work around this bug by changing the length of the total environment by a few bytes.  To do so, either add a new entry to the environment or remove an entry.  You can modify the environment with the SET command

/EXIT	Exit Windows to run a DOS program, then restart Windows.

/INV	(Invisible) Start the session or window as invisible.  No icon will appear and the session will only be accessible through the Task Manager or Window List.

/K	(Keep session or window at end) The session or window continues after the application program ends.  Use the EXIT command to end the session.

/MAX	(Maximized) Start the session or window maximized.

/MIN	(Minimized) Start the session or window minimized.

/WAIT	Wait for the new session or window to finish before continuing.  This switch is ignored when starting DOS programs under WIN-OS/2, because there is no way for Take Command to determine when a DOS program run under WIN-OS/2 has finished.


TEE

Purpose:	Copy standard input to both standard output and a file.

Format:	TEE [/A] file...

file:  One or more files that will receive the "tee-d" output.

/A(ppend)

See also:  Y and the redirection options.

Usage

TEE is normally used to "split" the output of a program so that you can see it on the display and also save it in a file.  It can also be used to capture intermediate output before the data is altered by another program or command.

TEE gets its input from standard input (usually the piped output of another command or program), and sends out two copies:  one goes to standard output, the other to the file or files that you specify.  TEE is not likely to be useful with programs which do not use standard output, because these programs cannot send output through a pipe.

For example, to search the file DOC for any lines containing the string "Take Command", make a copy of the matching lines in 4.DAT, sort the lines, and write them to the output file 4O.DAT:

c:\> find "Take Command" doc | tee 4.dat | sort > 4o.dat

If you are typing at the keyboard to produce the input for TEE, you must enter a Ctrl-Z to terminate the input.

See Piping for more information on pipes.

Option

/A	(Append) Append the output to the file(s) rather than overwriting them.


TEXT

Purpose:	Display a block of text in a batch file.

Format:	TEXT

     .

     .

     .

ENDTEXT

See also:  ECHO, SCREEN, SCRPUT, and VSCRPUT.

Usage

TEXT can only be used in batch files.

The TEXT command is useful for displaying menus or multi-line messages.  TEXT will display all subsequent lines in the batch file until terminated by ENDTEXT.  Both TEXT and ENDTEXT must be entered as the only command on the line.

To redirect the entire block of text, use redirection on the TEXT command itself, but not on the actual text lines or the ENDTEXT line.  No environment variable expansion or other processing is performed on the lines between TEXT and ENDTEXT; they are displayed exactly as they are stored in the batch file.

You can use a CLS or COLOR command to set the screen color before executing the TEXT command.

The following batch file fragment displays a simple menu:

@echo off & cls

screen 2 0

text

Enter one of the following:

1 - Spreadsheet

2 - Word Processing

3 - Utilities

endtext


TIME

Purpose:	Display or set the current system time.

Format:	TIME [hh [:mm :ss ]]] [AM | PM]

hh:  The hour (0 - 23).

mm:  The minute (0 - 59).

ss:  The second (0 - 59).

See also:   DATE.

Usage

If you don't enter any parameters, TIME will display the current system time and prompt you for a new time.  Press Enter if you don't wish to change the time; otherwise, enter the new time:.

c:\> time

Thu  Dec 22, 1994  9:30:10

New time (hh:mm:ss):

TIME defaults to 24-hour format, but you can optionally enter the time in 12-hour format by appending "a", "am", "p", or "pm" to the time you enter.

For example, to enter the time as 9:30 am:

c:\> time 9:30 am

Windows adds the system time and date to the directory entry for every file you create or modify.  If you keep both the time and date accurate, you will have a record of when you last updated each file.


TIMER

Purpose:	TIMER is a system stopwatch.

Format:	TIMER [ON] [/1 /2 /3 /S]

ON:  Force the stopwatch to restart

/1 (stopwatch #1)	/3 (stopwatch #3)

/2 (stopwatch #2)	/S(plit)

Usage

The TIMER command turns a system stopwatch on and off.  When you first run TIMER, the stopwatch starts:

c:\> timer

Timer 1 on:  12:21:46

When you run TIMER again, the stopwatch stops and the elapsed time is displayed:

c:\> timer

Timer 1 off:  12:21:58

Elapsed time: 0:00:12.06

There are three stopwatches available (1, 2, and 3) so you can time multiple overlapping events.  By default, TIMER uses stopwatch #1.

The smallest interval TIMER can measure depends on the operating system you are using, your hardware, and the interaction between the two.  However, it should never be greater than .06 second.  The largest interval is 23 hours, 59 minutes, 59.99 seconds.

Options

/1	Use timer #1 (the default).

/2	Use timer #2.

/3	Use timer #3.

/S	(Split) Display a split time without stopping the timer.  To display the current elapsed time but leave the timer running:

c:\> timer /s

Timer 1 elapsed: 0:06:40.63

ON	Start the timer regardless of its previous state (on or off).  Otherwise the TIMER command toggles the timer state (unless /S is used).


TITLE

Purpose:	Change the window title.

Format:	TITLE "title"

title: The new window title.

See also:  ACTIVATE and WINDOW.

Usage

TITLE changes the text that appears in the caption bar at the top of the Take Command window.  It is included for compatibility with traditional character-mode command processors (like WIndows NT's CMD.EXE).  You can also change the window title with the WINDOW command or the ACTIVATE command.

The title text must be enclosed in double quotes.  The quotes will not appear as part of the actual title.

To change the title of the current window to "Take Command Test":

c:\> title "Take Command Test"


TYPE

Purpose:	Display the contents of the specified file(s).

Format:	TYPE [/A[[:][-]rhsda] /L /P] file...

file:  The file or list of files that you want to display.

/A(ttribute select)	/P(ause)

/L(ine numbers)

See also:  LIST.

File Selection

Supports extended wildcards, ranges, multiple file names, and include lists.

Usage

The TYPE command displays a file.  It is normally only useful for displaying ASCII text files.  Executable files (.COM and .EXE ) and many data files may be unreadable when displayed with TYPE because they include non-alphanumeric characters.

To display the files MEMO1 and MEMO2:

c:\> type /p memo1 memo2

You can press Ctrl-S to pause TYPE's display and then any key to continue.

You will probably find LIST to be more useful for displaying files. However, the TYPE /L command used with redirection is useful if you want to add line numbers to a file.

Options

/A	(Attribute select):  Select only those files that have the specified attribute(s) set.  Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set.  The colon [:] after /A is required.  The attributes are:

R	Read-only	D	Subdirectory

H	Hidden	A	Archive

S	System

If no attributes are listed at all (e.g., /A), TYPE will select all files and subdirectories including hidden and system files.  If attributes are combined, all the specified attributes must match for a file to be selected.  For example, /A:RHS will select only those files with all three attributes set.

/L	(Line numbers) Display a line number preceding each line of text.

/P	(Pause) Prompt after displaying each page.  Your options at the prompt are explained in detail under Page and File Prompts.


UNALIAS

Purpose:	Remove aliases from the alias list.

Format:	UNALIAS [/Q] alias...

    or

UNALIAS *

alias:  One or more aliases to remove from memory.

/Q(uiet)

See also:  ALIAS and ESET.

Usage

Take Command maintains a list of the aliases that you have defined.  The UNALIAS command will remove aliases from that list.  You can remove one or more aliases by name, or you can delete the entire alias list by using the command UNALIAS *.

For example, to remove the alias DDIR:

c:\> unalias ddir

To remove all the aliases:

c:\> unalias *

Options

/Q	(Quiet) Prevents UNALIAS from displaying an error message if one or more of the aliases does not exist.  This option is most useful in batch files, for removing a group of aliases when some of the aliases may not have been defined.


UNSET

Purpose:	Remove variables from the environment.

Format:	UNSET  [/Q] name...

     or

UNSET *

name:  One or more variables to remove from the environment.

/Q(uiet)

See also:  ESET and SET.

Usage

UNSET removes one or more variables from the environment.  For example, to remove the variable CMDLINE:

c:\> unset cmdline

If you use the command UNSET *, all of the environment variables will be deleted:

c:\> unset *

UNSET is often used in conjunction with the SETLOCAL and ENDLOCAL commands in order to clear the environment of variables that may cause problems for some applications.

For more information on environment variables, see the SET command and the general discussion of the environment.

Use caution when removing environment variables, and especially when using UNSET *.  Many programs will not work properly without certain environment variables; for example, Take Command uses PATH and CDPATH.

UNSET can also be used to remove executable extensions created from Windows file associations.  If you UNSET a variable whose name begins with a period, and the variable does not exist in the environment, Take Command will check its list of Windows file associations and remove the setting from that list if necessary (this affects only Take Command's internal list, not the actual file associations defined for other Windows applications).  This allows you to disable specific file associations if you do not want them to operate within Take Command.  See Windows File Associations for additional details.

Options

/Q	(Quiet) Prevents UNSET from displaying an error message if one or more of the variables does not exist.  This option is most useful in batch files, for removing a group of variables when some of the variables may not have been defined.


VER

Purpose:	Display the current command processor and operating system versions.

Format:	VER [/R]

/R(evision level)

Usage

Version numbers consist of a one-digit major version number, a period, and a one- or two-digit minor version number.  The VER command displays both version numbers:

c:\> ver

ake Command 1.0   Windows Version is 3.1

Option

/R	(Revision level) Display the Take Command and Windows internal revision levels, plus your Take Command serial number and registered name.


VERIFY

Purpose:	Enable or disable disk write verification or display the verification state.

Format:	VERIFY [ON | OFF]

Usage

DOS maintains an internal verify flag.  When the flag is on, DOS attempts to verify each disk write by making sure that the data written to the disk can be read back successfully into the computer.  It does not compare the data written with the data actually placed on disk.

If used without any parameters, VERIFY will display the state of the verify flag:

c:\> verify

VERIFY is OFF

VERIFY is off when the system boots up.  Once it is turned on with the VERIFY ON command, it stays on until you use the VERIFY OFF command or until you reboot.

Verification will slow your disk write operations slightly (the effect is not usually noticeable).


VOL

Purpose:	Display disk volume label(s).

Format:	VOL [d:] ...

d:  The drive or drives to search for labels.

Usage

Each disk may have a volume label, created when the disk is formatted or with the external LABEL command.  Also, every floppy disk formatted with DOS version 4.0 or above or with Windows has a volume serial number.

The VOL command will display the volume label and, if available, the volume serial number of a disk volume.  If the disk doesn't have a volume label, VOL will report that it is "unlabeled."  If you don't specify a drive, VOL displays information about the current drive:

c:\> vol

Volume in drive C: is MYHARDDISK

If available, the volume serial number will appear after the drive label or name.

To display the disk labels for drives A and B:

c:\> vol a: b:

Volume in drive A: is unlabeled

Volume in drive B: is BACKUP_2


VSCRPUT

Purpose:	Display text vertically in the specified color.

Format:	VSCRPUT  row col [BRIght] fg ON [BRIght] bg text

row:  Starting row number.

col:  Starting column number.

fg:  Foreground text color.

bg:  Background text color.

text:  The text to display.

See also:  SCRPUT.

Usage

VSCRPUT writes text vertically on the screen rather than horizontally.  Like the SCRPUT command, it uses the colors you specify to write the text.  VSCRPUT can be used for simple graphs and charts generated by batch files.  It always leaves the cursor in its current position.

The row and column are zero-based, so on a standard 25 line by 80 column display, valid rows are 0 - 24 and valid columns are 0 - 79.  You can also specify the row and column as offsets from the current cursor position.  Begin the value with a plus sign [+] to move down the specified number of rows or to the right the specified number of columns before displaying text, or with a minus sign [-] to move up or to the left.

VSCRPUT checks for a valid row and column, and displays a "Usage" error message if either value is out of range.


WINDOW

Purpose:	Minimize or maximize the current window, restore the default window size, or change the window title.

Format:	WINDOW [MIN | MAX | RESTORE] [/POS=row,col,width, height] ["title "]

title:  A new title for the window.

/POS(ition)

Usage

WINDOW is used to control the appearance and title of the current window.  WINDOW MIN reduces the window to an icon, WINDOW MAX enlarges it to its maximum size, and WINDOW RESTORE returns the window to its default size and location on the desktop.

You can use the /POS option to set the location and size of the window on the desktop.  The row and column values of the /POS option select the window's origin (from the top left of the screen) while the width and height values determine its size.

If you specify a new title, the title text must be enclosed in double quotes.  The quotes will not appear as part of the actual title.

Option

/POS(ition):  Set the window screen position and size.  The syntax is /POS=row, col, width, height, where the values are specified in pixels or pels.  Row and col refer to the position of the bottom left corner of the window relative to the bottom left corner of the screen.


Y

Purpose:	Copy standard input to standard output, and then copy the specified file(s) to standard output.

Format:	Y file ...

file:  The file or list of files to send to standard output.

See also:  TEE.

Usage

The Y command copies input from standard input (usually the keyboard) to standard output (usually the screen).  Once the input ends, the named files are appended to standard output.

For example, to get text from standard input, append the files MEMO1 and MEMO2 to it, and send the output to MEMOS:

c:\> y memo1 memo2 > memos

The Y command is most useful if you want to add redirected data to the beginning of a file instead of appending it to the end.  For example, this command copies the output of DIR, followed by the contents of  the file DIREND, to the file DIRALL:

c:\> dir | y dirend > dirall

If you are typing at the keyboard to produce input text for Y, you must enter a Ctrl-Z to terminate the input.

See Piping for more information on pipes.


Error Messages

This section lists error messages generated by Take Command, and includes a recommended course of action for most errors.  If you are unable to resolve the problem, look through your Introduction and Installation Guide for any additional troubleshooting recommendations, then contact JP Software for technical support.

Error messages relating to files are generally reports of errors returned by Windows.  You may find some of these messages (for example, "Access denied") vague enough that they are not always helpful.  Take Command includes the file name in file error messages, but is often unable to determine a more accurate explanation of these errors.  The message shown is the best information available based on the error codes returned by Windows.

The following list includes all error messages, in alphabetical order:

Access denied:  You tried to write to or erase a read-only file, rename a file or directory to an existing name, create a directory that already exists, remove a read-only directory or a directory with files or subdirectories still in it, or access a file in use by another program in a multitasking system.

Alias loop:  An alias refers back to itself either directly or indirectly (i.e., a = b = a), or aliases are nested more than 16 deep.  Correct your alias list.

Bad disk unit:  Generally caused by a disk drive hardware failure.

Batch file missing:  Take Command can't find the batch (.BTM or .BAT) file it was running.  It was either deleted, renamed, moved, or the disk was changed.  Correct the problem and rerun the file.

Can't COPY or MOVE file to itself:  You cannot COPY or MOVE a file to itself.  Take Command performs full path and filename expansion before copying to ensure that files aren't inadvertently destroyed.

Can't create:  Take Command can't create the specified file.  The disk may be full or write protected, or the file already exists and is read-only, or the root directory is full.

Can't delete:  Take Command can't delete the specified file or directory.  The disk is probably write protected.

Can't get directory:  Take Command can't read the directory.  The disk drive is probably not ready.

Can't make directory entry:  Take Command can't create the filename in the directory.  This is usually caused by a full root directory. Create a subdirectory and move some of the files to it.

Can't open:  Take Command can't open the specified file.  Either the file doesn't exist or the disk directory or File Allocation Table is damaged.

Can't remove current directory:  You attempted to remove the current directory, which Windows does not allow.  Change to the parent directory and try again.

Command line too long:  A single command exceeded 255 characters, or the entire command line exceeded 511 characters, during alias and variable expansion.  Reduce the complexity of the command or use a batch file.  Also check for an alias which refers back to itself either directly or indirectly.

Command only valid in batch file:  You have tried to use a batch file command, like DO or GOSUB, from the command line or in an alias.  A few commands can only be used in batch files (see the individual commands for details).

Contents lost before copy:  COPY was appending files, and found one of the source files is the same as the target.  That source file is skipped, and appending continues with the next file.

Data error:  Windows can't read or write properly to the device. On a floppy drive, this error is usually caused by a defective floppy disk, dirty disk drive heads, or a misalignment between the heads on your drive and the drive on which the disk was created. On a hard drive, this error may indicate a drive that is too hot or too cold, or a hardware problem.  Retry the operation; if it fails again, correct the hardware or diskette problem.

Directory stack empty:  POPD or DIRS can't find any entries in the directory stack.

Disk is write protected:  The disk cannot be written to.  Check the disk and remove the write-protect tab or close the write- protect window if necessary.

Drive not ready -- close door:  The floppy disk drive door is open.  Close the door and try again.

Environment already saved:  You have already saved the environment with a previous SETLOCAL command.  You cannot nest SETLOCAL / ENDLOCAL pairs.

Error in command-line directive:  You used the //iniline option to place an .INI directive on the startup command line, but the directive is in error.  A more specific error message follows.

Error on line [nnnn] of [filename]:  There is an error in your TCMD.INI file.  The following message explains the error in more detail.  Correct the line in error and restart Take Command for your change to take effect.

Error reading:  Windows experienced an I/O error when reading from a device.  This is usually caused by a bad disk, a device not ready, or a hardware error.

Error writing:  Windows experienced an I/O error when writing to a device.  This is usually caused by a full disk, a bad disk, a device not ready, or a hardware error.

Exceeded batch nesting limit:  You have attempted to nest batch files more than 10 levels deep.

File Allocation Table bad:  Windows  can't access the FAT on the specified disk.  This can be caused by a bad disk, a hardware error, or an unusual software interaction.

File exists:  The requested output file already exists, and Take Command won't overwrite it.

File not found:  Take Command couldn't find the specified file.  Check the spelling and path name.

General failure:  This is usually a hardware problem, particularly a disk drive failure or a device not properly connected to a serial or parallel port.  Try to correct the problem, or reboot and try again.  Also see Data error above; the problems described there can sometimes cause a general failure rather than a data error.

Infinite COPY or MOVE loop:  You tried to COPY or MOVE a directory to one of its own subdirectories and used the /S switch, so the command would run forever.  Correct the command and try again.

Insufficient disk space:  COPY or MOVE ran out of room on the destination drive.  Remove some files and retry the operation.

Invalid character value:  You gave an invalid value for a character directive in the TCMD.INI file.

Invalid choice value:  You gave an invalid value for a "choice" directive (one that accepts a choice from a list, like "Yes" or "No") in the TCMD.INI file.

Invalid color:  You gave an invalid value for a color directive in the TCMD.INI file.

Invalid date:  An invalid date was entered.  Check the syntax and reenter.

Invalid directive name:  Take Command can't recognize the name of a directive in your TCMD.INI file.

Invalid drive:  A bad or non-existent disk drive was specified.

Invalid key name:  You tried to make an invalid key substitution in the TCMD.INI file, or you used an invalid key name in a keystroke alias or command.  Correct the error and retry the operation.

Invalid numeric value:  You gave an invalid value for a numeric directive in the TCMD.INI file.

Invalid parameter:  Take Command didn't recognize a parameter.  Check the syntax and spelling of the command you entered.

Invalid path:  The specified path does not exist.  Check the disk specification and/or spelling.

Invalid path or file name:  You used an invalid path or filename in a directive in the TCMD.INI file.

Invalid time:  An invalid time was entered.  Check the syntax and reenter.

Keystroke substitution table full:  Take Command ran out of room to store keystroke substitutions entered in the TCMD.INI file.  Reduce the number of key substitutions or contact JP Software for assistance.

Label not found:  A GOTO or GOSUB referred to a non-existent label. Check your batch file.

Missing ENDTEXT:  A TEXT command is missing a matching ENDTEXT.  Check the batch file.

Missing GOSUB:  Take Command cannot perform the RETURN command in a batch file.  You tried to do a RETURN without a GOSUB, or your batch file has been corrupted.

Missing SETLOCAL:  An ENDLOCAL was used without a matching SETLOCAL.

No aliases defined:  You tried to display aliases but no aliases have been defined.

No closing quote:  Take Command couldn't find a second matching back quote [`] or double-quote ["] on the command line.

No expression:  The expression passed to the %@EVAL variable function is empty.  Correct the expression and retry the operation.

Not an alias:  The specified alias is not in the alias list.

Not in environment:  The specified variable is not in the environment.

Not ready:  The specified device can't be accessed.

Not same device:  This error usually appears in RENAME.  You cannot rename a file to a different disk drive.

Out of memory:  Take Command or Windows had insufficient memory to execute the last command.  Try to free some memory by closing other sessions.  If the error persists, contact JP Software for assistance.

Out of paper:  Windows detected an out-of-paper condition on one of the printers (LPT1, LPT2, or LPT3).  Check your printer and add paper if necessary.

Overflow:  An arithmetic overflow occurred in the %@EVAL variable function.  Check the values being passed to %@EVAL. %@EVAL can handle 16 digits to the left of the decimal point and 8 to the right.

Read error:  Windows encountered a disk read error; usually caused by a bad or unformatted disk.

Sector not found:  Disk error, usually caused by a bad or unformatted disk.

Seek error:  Windows can't seek to the proper location on the disk.  This is generally caused by a bad disk or drive.

Sharing violation:  You tried to access a file in use by another program in a multitasking system or on a network.  Wait for the file to become available, or change your method of operation so that another program does not have the file open while you are trying to use it.

String area overflow:  Take Command ran out of room to store the text from string directives in the TCMD.INI file.  Reduce the complexity of the TCMD.INI file or contact JP Software for assistance.

Syntax error:  A command or variable function was entered in an improper format.  Check the syntax and correct the error.

Too many open files:  Windows has run out of file handles.

Unbalanced parentheses:  The number of left and right parentheses did not match in an expression passed to the %@EVAL variable function.  Correct the expression and retry the operation.

Unknown command:  A command was entered that Take Command didn't recognize and couldn't find in the current search path.  Check the spelling or PATH specification.  You can handle unknown commands with the UNKNOWN_CMD alias (see ALIAS).

Variable loop:  A nested environment variable refers to itself, or variables are nested more than 16 deep.  Correct the error and retry the command.

Write error:  Windows encountered a disk write error; usually caused by a bad or unformatted disk.


Key Code Tables

The tables in this section are based on U.S. English conventions.  Your system may differ if it is configured for a different country or language.  See your operating system documentation for more information about country and language support.

To represent the text you type, computers must translate each letter to and from a number.  The code used by all PC-compatible computers for this translation is called ASCII.  Function keys, cursor keys, and Alt keys generate scan codes indicating which key was pressed, but not ASCII codes. This section includes a table showing the codes for each key on your keyboard, and an explanation of how key codes work.

For more information, see:

Key Codes and Scan Codes Table

Key Codes and Scan Codes Explanation


Key Codes and Scan Codes Table

(For more details on key codes and scan codes, see the Key Codes and Scan Codes Explanation.)

Key names prefaced by np are on the numeric keypad.  Those prefaced by cp are on the cursor keypad between the main typing keys and the number keypad.  The numeric keypad values are valid if Num Lock is turned off.  If you need to specify a number key from the numeric keypad, use the scan code shown for the keypad and the ASCII code shown for the corresponding typewriter key.  For example, the keypad "7" has a scan code of 71 (the np Home scan code) and an ASCII code of 54 (the ASCII code for "7").

The chart is blank for key combinations that do not have scan codes or ASCII codes, like Ctrl-1 or Alt-PgUp.

Top Keyboard Row

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
Esc	1	27	1	27	1	27	1
1  !	2	49	2	33			120
2  @	3	50	3	64	3	0	121
3  #	4	51	4	35			122
4  $	5	52	5	36			123
5  %	6	53	6	37			124
6  ^	7	54	7	94	7	30	125
7  &	8	55	8	38			126
8  *	9	56	9	42			127
9  (	10	57	10	40			128
0  )	11	48	11	41			129
-  _	12	45	12	95	12	31	130
=  +	13	61	13	43			131
Backspace	14	8	14	8	14	127	14
Second Keyboard Row

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
Tab	15	9	15	0	148	0	165
Q	16	113	16	81	16	17	16
W	17	119	17	87	17	23	17
E	18	101	18	69	18	5	18
R	19	114	19	82	19	18	19
T	20	116	20	84	20	20	20
Y	21	121	21	89	21	25	21
U	22	117	22	85	22	21	22
I	23	105	23	73	23	9	23
O	24	111	24	79	24	15	24
P	25	112	25	80	25	16	25
[  {	26	91	26	123	26	27	26
]  }	27	93	27	125	27	29	27
Enter	28	13	28	13	28	10	28
Third Keyboard Row

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
A	30	97	30	65	30	1	30
S	31	115	31	83	31	19	31
D	32	100	32	68	32	4	32
F	33	102	33	70	33	6	33
G	34	103	34	71	34	7	34
H	35	104	35	72	35	8	35
J	36	106	36	74	36	10	36
K	37	107	37	75	37	11	37
L	38	108	38	76	38	12	38
; :	39	59	39	58			39
'  "	40	39	40	34			40
`  ~	41	96	41	126			41
\  |	43	92	43	124	43	28	43
Bottom Keyboard Row

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
Z	44	122	44	90	44	26	44
X	45	120	45	88	45	24	45
C	46	99	46	67	46	3	46
V	47	118	47	86	47	22	47
B	48	98	48	66	48	2	48
N	49	110	49	78	49	14	49
M	50	109	50	77	50	13	50
,  <	51	44	51	60			51
.  >	52	46	52	62			52
/  ?	53	47	53	63			53
Space	57	32	57	32	57	32	57
Function Keys

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
F1	59	0	84	0	94	0	104
F2	60	0	85	0	95	0	105
F3	61	0	86	0	96	0	106
F4	62	0	87	0	97	0	107
F5	63	0	88	0	98	0	108
F6	64	0	89	0	99	0	109
F7	65	0	90	0	100	0	110
F8	66	0	91	0	101	0	111
F9	67	0	92	0	102	0	112
F10	68	0	93	0	103	0	113
F11	133	0	135	0	137	0	139
F12	134	0	136	0	138	0	140
Numeric Key Pad

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
np *	55	42	55	42	150	0	55
np Home	71	0	71	55	119	0
np Up	72	0	72	56	141	0
np PgUp	73	0	73	57	132	0
np Minus	74	45	74	45	142	0	74
np Left	75	0	75	52	115	0
np 5	76	0	76	53	143	0
np Right	77	0	77	54	116	0
np Plus	78	43	78	43	144	0	78
np End	79	0	79	49	117	0
np Down	80	0	80	50	145	0
np PgDn	81	0	81	51	118	0
np Ins	82	0	82	48	146	0
np Del	83	0	83	46	147	0
np /	224	47	224	47	149	0	164
np Enter	224	13	224	13	224	10	166
Cursor Key Pad

Key Cap Symbol	Scan Code	ASCII Code	Shift Scan Code	Shift ASCII Code	Ctrl Scan Code	Ctrl ASCII Code	Alt Scan Code
cp Home	71	224	71	224	119	224	151
cp Up	72	224	72	224	141	224	152
cp PgUp	73	224	73	224	132	224	153
cp Left	75	224	75	224	115	224	155
cp Right	77	224	77	224	116	224	157
cp End	79	224	79	224	117	224	159
cp Down	80	224	80	224	145	224	160
cp PgDn	81	224	81	224	118	224	161
cp Ins	82	224	82	224	146	224	162
cp Del	83	224	83	224	147	224	163


Key Codes and Scan Codes Explanation

(This section explains how key codes and scan codes work.  For a reference chart, see the Key Codes and Scan Codes Table.)

When you press a single key or a key combination, Windows translates your keystroke into two numbers: a scan code, representing the actual key that was pressed, and an ASCII code, representing the ASCII value for that key.  Windows returns these numbers the next time a program requests keyboard input.  This section explains how key codes work; for information on using them with Take Command see the TCMD.INI file key mapping directives, keystroke aliases, and INKEY.

Most Take Command commands that use the numeric key codes listed here also use key names, which are usually more convenient to use than the numeric codes.  See Keys and Key Names for more information on key names.

As PCs have evolved, the structure of keyboard codes has evolved somewhat haphazardly with them, resulting in a bewildering array of possible key codes.  We'll give you a basic explanation of how key codes work.  For a more in-depth discussion, refer to a BIOS or PC hardware reference manual.

The nuances of how your keyboard behaves depends on the keyboard manufacturer, the computer manufacturer who provides the built-in BIOS, and your operating system.  As a result, we can't guarantee the accuracy of the information in the tables for every system, but the discussion and reference table should be accurate for most systems.  Our discussion is based on the 101-key "enhanced" keyboard commonly used on 286, 386, 486, and Pentium computers, but virtually all of it is applicable to the 84-key keyboards on older systems.  The primary difference is that older keyboards lack a separate cursor pad and only have 10 function keys.

All keys have a scan code, but not all have an ASCII code.  For example, function keys and cursor keys are not part of the ASCII character set and have no ASCII value, but they do have a scan code.  Some keys have more than one ASCII code.  The A, for example, has ASCII code 97 (lower case "a") if you press it by itself.  If you press it along with Shift, the ASCII code changes to 65 (upper case "A").  If you press Ctrl and A the ASCII code changes to 1.  In all these cases, the scan code (30) is unchanged because you are pressing the same physical key.

Things are different if you press Alt-A.  Alt keystrokes have no ASCII code, so Windows returns an ASCII code of 0, along with the A key's scan code of 30.  This allows a program to detect all the possible variations of A, based on the combination of ASCII code and scan code.

Some keys generate more than one scan code depending on whether Shift, Ctrl, or Alt is pressed.  This allows a program to differentiate between two different keystrokes on the same key, neither of which has a corresponding ASCII value.  For example, F1 has no ASCII value so it returns an ASCII code of 0, and the F1 scan code of 59.  Shift-F1 also returns an ASCII code 0; if it also returned a scan code of 59, a program couldn't distinguish it from F1.  The operating system translates scan codes for keys like Shift-F1 (and Ctrl-F1 and Alt-F1) so that each variation returns a different scan code along with an ASCII code of 0.

On the 101-key keyboard there's one more variation:  non-ASCII keys on the cursor keypad (such as up-arrow) return the same scan code as the corresponding key on the numeric keypad, for compatibility reasons.  If they also returned an ASCII code of 0, a program couldn't tell which key was pressed.  Therefore, these keys return an ASCII code of 224 rather than 0.  This means that older programs, which only look for an ASCII 0 to indicate a non-ASCII keystroke like up-arrow, may not detect these cursor pad keys properly.

The number of different codes returned by any given key varies from one (for the spacebar) to four, depending on the key, the design of your keyboard, and the operating system.  Some keys, like Alt, Ctrl, and Shift by themselves or in combination with each other, plus Print Screen, SysReq, Scroll Lock, Pause, Break, Num Lock, and Caps Lock keys, do not have any code representations at all.  The same is true of keystrokes with more than one modifying key, like Ctrl-Shift-A. The operating system may perform special actions automatically when you press these keys (for example, it switches into Caps Lock mode when you press Caps Lock), but it does not report the keystrokes to whatever program is running.  Programs which detect such keystrokes access the keyboard hardware directly, a subject which is beyond the scope of this manual.


Support

You can contact JP Software at any of the following addresses.  Our normal business hours are 9:00 AM to 5:00 PM weekdays, eastern US time.

By mail:

JP Software Inc.

P.O. Box 1470

East Arlington, MA 02174

USA

By telephone / fax:

Voice	(617) 646-3975

Fax	(617) 646-0904

Order Line	(800) 368-8777 (orders only, USA only)

Electronically:

CompuServe

Customer Service 75020,244

Technical Support, GO JPSOFT or GO PCVENB (section 10), User ID 75300,1215

Internet

Customer Service 75020.244@compuserve.com

Technical Support 75300.1215@compuserve.com

BBS Support

Via Channel 1 BBS, Boston, 617-354-5776 at 2,400 - 14,400 baud, no parity, 8 data bits, 1 stop bit.

Technical support is available via public electronic support conferences, private electronic mail, telephone, fax, and mail.

Often the best way to contact us for support is in one of the following public electronic support conferences.  The numbers in parentheses indicate the usual delay, in business days, to receive a reply to a message.

CompuServe / ZiffNet:  Primary support is via the JP Software section of the CompuServe PCVENB forum (GO JPSOFT or GO PCVENB, section 10, "JP Software") (1 day).

Bulletin Boards:  Primary support is via the Channel 1 BBS, Boston, MA (1 - 3 days; see above for access details).  Messages may be left in any of the "4DOS" conferences; check the online list for exact conference numbers.  Support is also available from many local BBSes via the "4DOS" conferences on the RIME, ILink, SmartNet, and FidoNet BBS Networks (3-5 days).

Before contacting us for support, please check the manuals and other documentation for answers to your question.  If you can't find what you need, try the Index.  If you're having trouble getting Take Command to run properly, either alone or with your particular hardware or software, see the Introduction and Installation Guide, and the APPNOTES.DOC file.  Also look through the README.DOC and UPDATxxx.DOC files, as they may contain updates to the manual or other important information ("xxx" is the version number).

If you do need to contact us for support, it helps if you can give us some basic information:

What exactly did you do?  A concise description of what steps you must take to make the problem appear is much more useful than a long analysis of what might be happening.

What went wrong?  At what point did the failure occur?  If you saw an error message or other important or unusual information on the screen, what exactly did it say?

Briefly, what techniques did you use to try to resolve the problem?  What results did you get?

What computer and operating system version are you using?

Are you running a network?  If so, which one, and which version?

What are the contents of any startup files you use (such as TCSTART, TCEXIT, and TCMD.INI ), any batch files they call, and any alias or environment variable files they load?

Can you repeat the problem or does it occur randomly?  If it's random, does it seem related to the programs you're using when the problem occurs?