Arguments, Commas, and Quotes
When a command-line program requires you to specify information such as the name of a file to process or an option to use, you usually type this information after the command name with the items separated by spaces. For example, the delete command erases the file or files named on its command line:
delete somefile.txt anotherfile.txt
You can also separate command-line arguments with the semicolon (;) or comma (,), but this is not recommended; CMD accepts this to be compatible only with good old COMMAND.COM.
Unfortunately, because Windows filenames can contain spaces in the middle of the name, the command
delete c:\Users\bknittel\Documents\My Music\mpeg files\files.txt
attempts to delete three files: C:\Users\bknittel\Documents\My, Music\mpeg, and files\files.txt.To solve this problem, CMD interprets quotation marks (") to mean that the text enclosed is to be treated as part of one single argument. For example, the command
delete "c:\Users\bknittel\Documents\My Music\mpeg files\files.txt"
deletes the one indicated file.The quotation marks are not seen as part of the filename; they just keep it all together.
In this tutorial:
- The CMD Command-Line
- 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