Batchography: Useful keyboard shortcuts for editing and working with the command prompt


In the Batchography book, not only you will learn about the command prompt’s keyboard shortcuts, macros and what not, but you will also learn the basic and fundamental topics for programming in the Batch language.

In this blog post, I present to you an excerpt from Chapter 1 in the Batchography book that covers all the useful keyboard shortcuts. My new favorite one is the F11 keyboard shortcut that is present in Windows 10 and up.

Get the book from Amazon: printed editionbtn-buy-on-amazonor the Kindle edition btn-buy-on-amazon.

flower separator

Command editing keyboard shortcuts

The following keyboard shortcuts assist you in editing, finding, selecting, copying or pasting the text in the command prompt.

Shortcut Description
Hold SHIFT +
Use direction keys
Mark mode #1: it is possible to select, copy, paste and find text in the command window.
In order to select text, simply press and hold the SHIFT key and then use one of the direction or
page scrolling keys (UP, DOWN, LEFT, RIGHT, HOME, END, PgDn or PgUp). By doing this, the selection mode will start.
Ctrl-M Mark mode #2: Similarly, you can press Ctrl-M to start the selection mode (aka “Mark Mode”).
Ctrl+A Select all: Whether you are already in text selection mode or not, press Ctrl+A to select the whole console window text.
Copy selection: Press ENTER, Ctrl-Shift-C or Ctrl-Insert to copy the selection to the clipboard. Press ESC to cancel the selection.
Paste selection: After a selection is made, Right-click again with the mouse, or press Ctrl-V or Shift-Insert to paste text from the clipboard.
Arrow Keys Moving the cursor one character at a time: To edit the text and do corrections, use the LEFT or RIGHT keys to move the cursor one letter at a time.
Ctrl + Arrow keys Moving the cursor one word at a time: Use Ctrl-Left or Ctrl-Right to move the cursor one word at a time to the left or to the right.
Going to start or end of the line: Use the HOME key to take the cursor to the beginning of the line and the END key to go to the end of the typed text.
Scroll up or down: Press the Ctrl-Up or the Ctrl-Down keys to scroll the console window up or down by a single line.
Delete a single character: Press the BackSpace key to delete the character before the cursor and press the DEL key to delete the character at the cursor.
Delete all text to the left or right of the cursor: Use the Ctrl-End key to delete all the text to the right of the cursor,
and use the Ctrl-Home key to delete all the letters to the left of the cursor.
Ctrl-F Find text: Press Ctrl-F to bring up the “Find text” dialog. Start typing any text to search for in the console window text then press ENTER.
Keep pressing ENTER to cycle between the matches. Press ESC to close the dialog.
F11 Full screen mode (Windows 10+ only): Press F11 to toggle the full screen mode.
Mouse left and right-click Select, copy and paste with the mouse: If the “Quick Edit” mode is enabled, then you can directly start text selection by clicking with the mouse on the text inside the command prompt.
If “Quick Edit” mode was disabled, then you can Right-Click anywhere inside the console window and then choose the “Select” menu item.
End-Of-file character: Press Ctrl+Z or F6 to emit the EOF (end of file) character (^Z).
This is handy when the standard input is redirected to the console and you want to signal the end of editing/end of file.

Command recall keyboard shortcuts

Shortcut Description
UP / DOWN When you type a command in the prompt, you can press the UP or DOWN arrows on your keyboard to recall the commands.
ESC If you press the ESC key, then you may cancel the recall which will clear the proposed command recall text.
F8 You may also start typing one or more letters then press F8 repeatedly to recall commands that start with the letters you typed.
F7 If you press F7, then a list with the command history will pop up on the screen.

Each command in that history list will be prefixed by a command number. You may then use the arrow keys to choose a command to recall.
Press ENTER to recall a command or ESC to dismiss the history window.

F9 Press F9 to recall a command by entering its command number (one of the values you saw in the F7 screen).
When you press ENTER then the command will be pasted-in but not executed.
(This gives you a chance to edit and modify the command before running it.)
F3 Press F3 to recall the last command (this is equivalent to pressing the UP key). Invoking this command repeatedly does not do anything.
F1 Press F1 to recall just a single letter at the current cursor position. The letter that is recalled is from the last command that you entered.
Alt-F7 Clear the command history.

flower separatorYou might also like:

Leave a Reply