===== 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 you enter can be up to 1023 characters long. 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: ==== |Ins |Toggle between insert and overtype mode. | |Del |Delete the character at the cursor. | |Backspace |Delete the character to the left of the cursor. | |Ctrl-L |Delete the word or partial word to the left of the cursor. | |Ctrl-R or Ctrl-Bksp |Delete the word or partial word to the right of the cursor. | |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. | ==== Execution: ==== |Ctrl-C or Ctrl-Break |Cancel the command line. | |Enter |Execute the command line. | Most of the command-line editing capabilities are also available when a **CMD.EXE** command prompts you for a line of input. For example, you can use the command-line editing keys when [[en:docs:os2:cmd:internal:describe|DESCRIBE]] prompts for a file description, when [[en:docs:os2:cmd:internal:input|INPUT]] prompts for input from an alias or batch file, or when [[en:docs:os2:cmd:internal:list|LIST]] prompts you for a search string. If you want your input at the command line to be in a different color from **CMD.EXE**'s prompts or output, you can use the Display page of the [[en:docs:os2:cmd:internal:option|OPTION]] dialogs, or the [[en:docs:os2:cmd:ini:directives:color:input-colors|InputColors]] directive in //CMD.INI//. **CMD.EXE** will prompt for additional command-line text when you include the [[en:docs:os2:cmd:other:escape|escape character]] as the very last character of a typed command line. The default escape character is the caret [^]. For example: [c:\] echo The quick brown fox jumped over the lazy^ More? sleeping dog. > alphabet Sometimes you may want to enter one of the command line editing 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 **CMD.EXE** 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 [[en:docs:os2:cmd:ini:directives:keymap|key mapping directives]] in the //.INI// file, and **Alt-255** itself can be reassigned with the [[en:docs:os2:cmd:ini:directives:keymap:editline:command-escape|CommandEscape]] directive.