The CMD Command-Line
This tutorial introduces the command-line environment, command-line programs can be powerful and useful, the CMD shell has many improvements over COMMAND.COM and the built-in commands provided by CMD perform many file and management functions.
Windows Script Host (WSH) programming and proclaiming it to be the right tool for all Windows automation tasks.
Although most of the fanfare over programming advances in the last decade have been over windowed applications with pull-down menus, dialog boxes, and all that jazz, the old-fashioned command line has been quietly becoming more sophisticated and capable as well. If you click Start, All Programs, Accessories, Command Prompt, a window appears that looks a lot like what you would have seen back in the days of the original Microsoft MS-DOS.You can type the old commands such as dir and cls, and Windows dutifully prints a directory listing and clears the screen.
However, as much as this looks like the MS-DOS prompt, under the hood, it's a completely different animal. New commands, some spiffy new user interface tricks, and access to some of the most powerful maintenance and configuration tools in Windows make the command-prompt environment an effective place to work with programs and files.
For example, a large number of utilities are available for network and Internet file copying, troubleshooting, configuration, and management. Many Windows maintenance tasks can be performed from the command line, and many file- and graphicsconversions tools have command-line access.The batch file scripting language lets you write command-line tools of your own. This tutorial covers the command-prompt environment itself.
In this tutorial:
- CMD Versus COMMAND
- Running CMD
- Opening a Command Prompt Window with Administrator Privileges
- CMD Options
- Disabling Command Extensions
- Command-Line Processing
- Console Program Input and Output
- Using the Console Window
- I/O Redirection and Pipes
- Copy and Paste in Command Prompt Windows
- Command Editing and the History List
- Name Completion
- Enabling Directory Name Completion
- Multiple Commands on One Line
- Grouping Commands with Parentheses
- Arguments, Commas, and Quotes
- Escaping Special Characters
- Configuring the CMD Program
- The Search Path
- Changing the Path
- Predefined and Virtual Environment Variables
- Setting Default Environment Variables
- Built-in Commands
- Extended Commands
- Listing Files with the Dir Command
- Paginating Long Listings
- Printing Directory Listings
- Sorting Listings
- Locating Alternate File Streams
- Setting Variables with the Set Command
- Conditional Processing with the if Command
- Scanning for Files with the for Command
- Using the for Command's Variable
- Processing Directories
- Numerical for Loop
- Getting More Information