Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
Multiple Commands on a Single Line May Not Run When You Use the && Command Separator
Article ID: 279253 - View products that this article applies to.
This article was previously published under Q279253
The double ampersand (&&) command separator may not run the commands to the right of && command.
For example, when you run the following command, the pause command does not run when a floppy disk is not in drive A, and you receive a "The device is not ready" message:
dir a: && pause
This behavior occurs because the && command separator performs error checking. If the command to the left of the && command does not return the expected results, the commands to the right of the && command do not run.
To resolve this issue, use the single & command separator. When you use a single & command, error checking is not performed and all commands run.
The following sample command displays a list of files in the current folder, and then runs the pause command even if the dir a: command does not work:
dir a: & pauseThe following samples provide more examples of the && command separator. Note that in these examples, a, b, and c represent commands.
a && b && cIf command a does not run, then commands b and command c do not run. If command b does not run, then command c does not run.
a & b & cIn this example, commands a, b, and c always run.
To view the online documentation for the && command separator or for other MS-DOS commands, type the following command at a command prompt:
Article ID: 279253 - Last Review: March 2, 2007 - Revision: 3.2