blank.gif (43 bytes)

Church Of The
Swimming Elephant

Search:
index.gif

ntcmds00000000.gif

Doskey--Notes

Using Doskey

The Doskey program is always available for all character-based, interactive programs (such as programming debuggers or file transfer programs), and maintains a command history buffer and macros for each program started. You cannot use doskey switches from a program; doskey switches must be issued before starting a program. Program key assignments override doskey key assignments.

Recalling a command

To recall a command, you can use any of the following keys after loading Doskey into memory. If using the Doskey program within a program, that program's key assignments take precedence.

UP ARROW
Recalls the command you used before the one displayed.
DOWN ARROW
Recalls the command you used after the one displayed.
PAGE UP
Recalls the oldest command you used in the current session.
PAGE DOWN
Recalls the most recent command you used.

Editing the command line

With the Doskey program, you can edit the current command line. If using the Doskey program within a program, that program's key assignments take precedence and not all Doskey editing keys may work.

The following list describes the Doskey editing keys and their functions:

LEFT ARROW
Moves the cursor back one character.
RIGHT ARROW
Moves the cursor forward one character.
CTRL+LEFT ARROW
Moves the cursor back one word.
CTRL+RIGHT ARROW
Moves the cursor forward one word.
HOME
Moves the cursor to the beginning of the line.
END
Moves the cursor to the end of the line.
ESC
Clears the command from the display.
F1
Copies one character from the same column in the template to the same column in the Windows NT command prompt. (The template is a memory buffer that holds the last command you typed.)
F2
Searches forward in the template for the next key you type after pressing F2. Doskey inserts the text from the template up to but not including the character you specify.
F3
Copies the remainder of the template to the command line. Doskey begins copying characters from the position in the template that corresponds to the position indicated by the cursor on the command line.
F4
Deletes characters from the current cursor position up to a character you specify. To use this editing key, you press F4 and type a character. Doskey deletes the characters from the current cursor position to the first letter specified.
F5
Copies the template into the current command line.
F6
Places an end-of-file character (CTRL+Z) at the current cursor position.
F7
Displays all commands for this program stored in memory in a pop-up box. Use the up and down arrow keys to select the command you want and press ENTER. The command will run. You can also note the sequential number in front of the command and use this number in conjunction with the F9 key.
ALT+F7
Deletes all commands stored in memory for the current history buffer.
F8
Displays all commands in the history buffer that start with the characters in the current command.
F9
Prompts you for a history buffer command number, then displays the command associated with the number you specify. Press ENTER to run the command. To display all the numbers and their associated commands, press F7.
ALT+F10
Deletes all macro definitions.

Using Doskey within a program

Certain character-based, interactive programs, such as programming debuggers or file transfer programs (FTP), automatically use the Doskey program. To use Doskey a program must be a console process and use buffered input. Any program key assignments override Doskey key assignments. For example, if the program uses the F7 key for some function, you will be unable to get a Doskey command history in a popup window.

Doskey maintains a command history for each program you start, allows you to repeat and edit previous commands at the program's prompt, and allows you to start Doskey macros created for the program. If you exit then restart a program from the same command prompt window, the command history from the previous program session will be available.

Doskey switches must be issued before starting a program. You cannot use Doskey switches from a program's command prompt, even if the program has a shell command.

If you use a program frequently and want to customize how Doskey works with the program and to create Doskey macros for that program, you can create a batch program that modifies Doskey and starts the program.

Specifying a default insert mode

If you press the INSERT key, you can type text on the Doskey command line in the middle of old text without replacing the old text. However, once you press ENTER, Doskey returns your keyboard to replace mode. You must press INSERT again to return to insert mode.

The /insert switch puts your keyboard in insert mode each time you press ENTER. Your keyboard effectively remains in insert mode until you use the /overstrike switch. You can temporarily return to replace mode by pressing the INSERT key; but once you press ENTER, Doskey returns your keyboard to insert mode.

The cursor changes shape when you use the INSERT key to change from one mode to the other.

Creating a macro

You can use the Doskey program to create macros that carry out one or more commands.

You can use the following special characters to control command operations when defining a macro:

$G or $g
Redirects output. Use either of these special characters to send output to a device or a file instead of to the screen. This character is equivalent to the redirection symbol for output (>).
$G$G or $g$g
Appends output to the end of a file. Use either of these special double characters to append output to an existing file rather than replace the data in the file. These double characters are equivalent to the "append" redirection symbol for output (>>).
$L or $l
Redirects input. Use either of these special characters to read input from a device or a file instead of from the keyboard. This character is equivalent to the redirection symbol for input (<).
$B or $b
Sends macro output to a command. Using one of these special characters is equivalent to using the pipe (|) on a command line.
$T or $t
Separates commands. Use either of these special characters to separate commands when you are creating macros or typing commands on the Doskey command line. Using one of these special characters is equivalent to using the ampersand (&) on a command line.
$$
Specifies the dollar-sign character ($).
$1 through $9
Represent any command-line information you want to specify when you run the macro. The special characters $1 through $9 are batch parameters, which make it possible for you to use different data on the command line each time you run the macro. The $1 character in a doskey command is similar to the %1 character in a batch program.
$*
Represents all the command-line information you want to specify when you type the macro name. The special character $* is a replaceable parameter that is similar to the batch parameters $1 through $9, with one important difference. Here, everything you type on the command line after the macro name is substituted for the $* in the macro.

For example, to create a macro that performs a quick and unconditional format of a disk, type the following command:

doskey qf=format $1 /q /u
For information about quick and unconditional formatting, see the format command.

Running a Doskey macro

To run a macro, type the macro name starting at the first position on the command line. If the macro was defined with $* or any of the batch parameters $1 through $9, use a space to separate parameters.

You could run the QF macro created in the previous example to format a disk in drive A quickly and unconditionally. To do so, you would type the following command:

qf a:

You cannot run a Doskey macro from a batch program.

Creating a macro with the same name as a Windows NT command

You might want to create a macro that has the same name as a Windows NT command. This can be useful, for example, if you always use a certain command with specific switches. To specify whether you want to run the macro or the Windows NT command, follow these guidelines:

ntcmds00000002.gif To run the macro, begin typing the macro name immediately after the command prompt, with no space between the prompt and the command name.

ntcmds00000002.gif To carry out the command, insert one or more spaces between the command prompt and the command name.

Deleting a macro

To delete a macro, type the following command:

doskey macroname=

More Information About Doskey

ntcmds00000001.gif Doskey--Examples

ntcmds00000001.gif Doskey

Cotse.Net

Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

 
.
www.cotse.com
Have you gone to church today?
.
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 Cotse.com.
Cotse.com is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609