Back before the invention of the mouse and Graphical User Interface, there was the command prompt. Every operating system (e.g. UNIX, CP/M, MS-DOS, VMS, etc.) of the day had some type of command line interface. If you're a command prompt power user or purest, the tricks below will show you how to fully utilize the Window's command prompt.Environmental Variables
This document is not meant as a introduction to the command line, its meant to help command prompt power users get the most out of this feature.
Copy Text From Command Prompt
Right-click on the title bar and select Edit and Mark. Left-click and select the text that you want to copy into the clipboard, then press the Enter key. Right-click to paste the text into the command prompt, or choose the Paste command (control-v) to paste the text into a Windows application.
Quick Edit Mode
Right-click on the title bar and click Properties. Under the Options tab check the box for QuickEdit Mode. Press the OK button when done.
After that you can left-click and select text that you want to copy into the clipboard, then press the Enter key. Right-click to paste the text into to the command prompt, or choose the Paste command (control-v) to paste the text into a Windows application.
Customizing the Command Prompt Look
All customization options are available by right-clicking on the title bar and clicking Properties. From here you can change the cursor size, window size, fonts, colors and more. It's highly recommended that you click on the Layout tab, in the Screen Buffer Size section set it to 9999. This will allow you to go back through your command prompt history to later review or save it.
At the command prompt type SET to display all the environmental variables on the local system. These environmental variables are used for several things, for example the %Path% (note '%VariableName%' between the percentage signs is used to designate these items) this variable holds the search path that Windows will use to try to find a command that is entered. Instead of typing C:\Users\Tim\Desktop to get to your desktop, you could type %UserProfile%\Desktop.
Windows supports two wildcard characters, which are the '*' (asterisk sign) and '?' (question mark). The '*' wildcard can represent any number of alphanumeric characters, for example: DIR C:\Windows\System32\*.EXE (this would display all files that have the .EXE extension). The '*' wildcard can represent signal alphanumeric characters, for example: DIR C:\Windows\System32\Example.D?? (this would display all files that have the name of example, and an extension that begins with "D").
Starting the Command Prompt in Elevated Mode
To open the command prompt with administrative elevated privileges, from the Start Menu, in the Search field (or from the Run... command) type CMD then press Ctrl+Shift+Enter.
"Open Command Window Here"
To open a command prompt referenced to a folder of your choice. Hold down the Shift key while right-clicking a folder, in the context menu select Open Command Window Here.
Running Multiple Commands
Change the Command Console:
Windows Sleep Command
When creating a batch file you sometimes need to script to pause for a few seconds before executing the next command. Unfortunately Windows batch doesn't support a build-in sleep command. Although, you can work around this by using (forces the script to pause for roughly 5 seconds):
Command prompt redirectors allow you to manipulate how the input or output of a program is displayed or used. Redirectors are used by appending them to the end of a command followed by what you are redirecting to. For example: dir > dir.txt (send the output form the DIR command sends it to a text file).
There are four command prompt redirectors:
Note: The command prompt supports devices like AUX, COMn, LPTn, NUL and PRN and treats them like files (these are known as 'reserved names'). Some of these device names are obsolete if your computer doesn't have these ports on them (such as: COMn and LPTn).
Redirecting Output from the Command Prompt to the Windows Clipboard
Command Prompt Keyboard Shortcuts