Windows 7 / Getting Started

Changing Screen Colors with the Color Command

The Color command changes the foreground (text) and background colors of the command window. This command uses the following syntax:

COLOR [FG]

The following describes the command line argument.

FG Sets the foreground (F) and background (G) colors. You must place the values together, without any space between. If you use the Color command without specifying color values, the command changes the colors to the default values used when you opened the command window. The following list tells you which colors you can use at the command prompt, along with their associated color number.

0-Black
1-Blue
2-Green
3-Aqua
4-Red
5-Purple
6-Yellow
7-White
8-Gray
9-Light blue
A-Light green
B-Light aqua
C-Light red
D-Light purple
E-Light yellow
F-Bright white

Working with the System Date Using the Date Command

The Date command displays or sets the system date. This command uses the following syntax:

DATE [{/T | date}]

The following list describes each of the command line arguments.

/T Displays the date without prompting for a new date. This command line switch only works when you enable command extensions.

date Specifies the new system date.

Tracking Command Line Actions with the DosKey Utility

The DosKey utility performs three tasks. First, it provides the history feature that most people use to scroll through existing command line entries. Press Down Arrow to see the next command, Up Arrow to see the previous command, Page Down to see the most recent command, and Page Up to see the oldest command in the history.

Second, you can use this command to edit previous commands. The following list describes the editing features.

LEFT ARROW Moves to the previous character in the command.

RIGHT ARROW Moves to the next character in the command.

CTRL+LEFT ARROW Moves to the previous word in the command.

CTRL+RIGHT ARROW Moves to the next word in the command.

HOME Moves to the beginning of the line.

END Moves to the end of the line.

ESC Clears the command from the display.

F1 Copies the next character from the same column in the command that you previously issued.

NOTE: The system places the previous command in a special area of memory called the template and lets you work with that command based on the current column position. For example, if you typed Dir *.BAK as the previous command, executed it, and then typed Dir at the command line, pressing F1 would type a space. Pressing F1 again would type the asterisk (*) and so on. Using the same example, pressing F2 and then the letter A would display Dir *.BA at the command prompt. Using the combination of the template and function keys helps you reduce the number of keystrokes you make to type a command.

F2 Searches forward in the previous command for the next key you type after pressing F2.

F3 Copies the remainder of the previous command to the command line.

F4 Deletes characters from the current cursor position up to a character you specify. For example, if the command line currently displays Dir *.BAK and the cursor is blinking under the asterisk (*), pressing F4 and the letter B would change the command prompt to read Dir BAK.

F5 Copies the previous command into the current command line.

F6 Places an end-of-file character (Ctrl+Z) at the current cursor position. You typically use this feature when using the console to create a file.

F7 Displays all of the commands stored in the command history in a dialog box. Select a command using the Up Arrow and Down Arrow. Press Enter to select the command. DosKey types the selected command at the command prompt. Press Enter again to execute the command. You can also note the sequential number in front of the command and use this number with the F9 key.

ALT+F7 Deletes all commands stored in the current command history buffer.

F8 Displays a single command from the command history that starts with the characters in the current command. Press F8 multiple times to cycle through the list of matching commands.

F9 Prompts you for a history buffer command number, and then displays the command associated with the number you specify. Press Enter to run the command. Press F7 to display a list of commands in the command history buffer, along with their associated command number.

ALT+F10 Deletes all macro definitions.

Third, you can use this command to create macros. The macros automate some command line tasks, similarly to batch files, but far more inconveniently. You can also use these macros to interact with applications. However, the number of applications that can use DosKey macros is extremely limited. For example, you could use a DosKey macro with the FTP utility. To qualify for use with the DosKey utility, the application must run at the command prompt and provide buffered input. Because of the limitations posed by DosKey macros. However, you can find many examples of DosKey macros online. This utility uses the following syntax:

DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]]
  [/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename]
  [macroname=[text]]

The following list describes each of the command line arguments.

/REINSTALL Installs a new copy of DosKey. Use this feature when your current copy has become corrupted or simply filled with extraneous data.

/LISTSIZE=size Determines the number of commands that will fit within the command history buffer. The default setting is 10.

/MACROS Displays a list of all of the DosKey macros. The output includes command line macros, as well as those associated with an application.

/MACROS:ALL Displays a list of all the DosKey macros for all executables that have DosKey compatibility. For example, if you create a DosKey macro for the FTP utility, this command line switch would display it.

/MACROS:exename Displays a list of all the DosKey macros associated with the specified application.

/HISTORY Displays a list of all of the commands in the command history buffer.

/INSERT Places DosKey in insert mode. Any new text you type at the command line appears in addition to the existing text.

/OVERSTRIKE Places DosKey in overstrike mode. Any new text you type at the command line replaces (overwrites) existing text.

/EXENAME=exename Specifies the name of an executable to use when creating a macro. The resulting macro runs within that application. The application must support DosKey to use this functionality. If you don't specify this command line switch, any macro you create or install runs at the command line and not as part of an application.

/MACROFILE=filename Specifies a file containing macros that you want to install.

macroname Specifies the name for a macro you create. Typing the macro name, followed by an equals sign, and pressing Enter deletes a macro from the list.

text Contains the text of the macro you want to record. You must include a macro name, followed by an equals sign, followed by the macro text to use this argument. For example, you can define a macro named MyDir that displays a directory by typing DosKey MyDir=Dir *.* /P and pressing Enter. After you create this macro, you can type MyDir at the command prompt, press Enter, and DosKey will execute the MyDir macro.

[Previous] [Contents] [Next]