DOSKEY Saves Typing
DOSKEY is a utility that is constantly running in the background of the command prompt and can be very valuable-if you know how to use it. Every time you enter a command in a command prompt session, it is recorded by DOSKEY and it can be recalled.
As an example, imagine you're testing connectivity with a server using the following ping command:
Ping DC1.Training.MCITPSuccess.com
You could execute the command and then realize the NIC wasn't configured correctly, or the host cache needed to be cleared with IPConfig /FlushDNS, or something else needed to be done. After resolving the issue, you want to execute the command again. Instead of typing it in from scratch, simply use the up arrow to recall it, press Enter, and you've executed it again (without typing it again).
The up arrow can be used to retrieve any previous command that you've entered in this session (up to the limit of the buffer, which is rather large). This can be valuable when you're entering very long commands or even short commands if you use the hunt-and-peck method of typing.
Typos are also common at the command line. However, you don't have to retype the entire command. You can use the up arrow instead to recall the command and then use the left and right arrows to position the cursor where you want to modify the text. Make your corrections, press Enter, and the corrected command executes.
You can also use the F7 key to display a pop-up window that shows a history window. It includes all of the commands you've entered in the current session. You can then use the up or down arrow to select the desired command.
DOSKEY is a command-prompt utility itself, and it includes some commands you can use. For example, if you want to view all the commands that have been entered in the current session, enter DOSKEY/History.
By default, the system includes a buffer size of 50 commands. If you need more, you can modify the buffer size. For example, the following command changes the buffer to 99:
DOSKEY /Listsize=99
In this tutorial:
- Working with the Command Prompt
- Starting and Ending a Command Prompt Session
- Easy ways to invoke administrator Command Prompt sessions
- Starting Command Prompt at a Particular Folder
- Strings with Spaces Need Quotes
- Cmd.exe vs. Command.com
- Commands Are Not Case Sensitive
- Starting Command Prompt and Running a Command
- Cmd.exe and Other Command Prompts
- Using AutoRun to Execute Commands When Command Prompt Starts
- Using Cmds Command-Line Syntax
- Using Commands
- Type /? for help
- Starting Programs
- Open Windows Explorer at the current Command Prompt folder
- Using File-Name and Folder-Name Completion
- Use a different completion character
- Using Wildcards
- Editing the Command Line
- Using Command Symbols
- The Redirection Symbols
- The Pipe Symbol
- The Command Combination Symbols
- Pausing or Canceling Commands
- Simplifying Command Entry with Doskey Macros
- DOSKEY Saves Typing
- System Variables Identify the Environment
- Viewing Environment Variables
- Modifying Environment Variables
- Predefined Environment Variables
- Customizing Command Prompt Windows
- Setting the Window Size and Position
- Setting the Window Size and Position Visually
- Selecting a Font
- Setting Colors
- Setting Other Options
- Copy and paste in the command prompt window
- Navigating from the command prompt
- Printing a list of filenames
- Commands Use Paths
- Identifying Executables
- Modifying the Path to Executables
- Modifying the Path with the GUI
- Changing the Current Path with CD
- Changing the Current Path with Windows Explorer
- Capturing the Output
- A Sampling of Commands
- Dir
- Copy
- XCopy
- SET
- NET USE
- SystemInfo
- DriverQuery
- Echo
- Advanced Shell Commands
- Creating a Batch File
- Scheduling a Batch File
- Creating Scheduled Tasks with a Script
- Using Windows PowerShell and the PowerShell ISE
- Windows PowerShell ISE
- PowerShell Commands
- Verbs and Nouns
- Sending Output to a Text File
- PowerShell Syntax
- Variables Created with a $ Symbol
- Comparison Operators
- Parentheses, Brackets, and Braces
- Running PowerShell Scripts
- PowerShell Execution Policy
- Changing the Execution Policy
- Looping
- Collections
- Creating a PowerShell Script
- Documenting Scripts
- Using PowerShell Commands
- Getting Help on PowerShell
- Using WMI_Cmdlets
- Getting Details on an Object
- Querying Information on Specific Objects
- Terminate Applications with Win32_process
- Formatting Output with the -f Format Operator
- Filtering the Output with the Where-Object Command
- Using the IF statement
- Using the Switch Statement
- Script Reusability