Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that you can run two commands in sequence, with one line, by putting && between them like this:

hostname && w32tm /query /configuration

However, this && function has a limitation: It only executes the second command if the first is successful.

My preferred use for && is to run informational commands directly from Start->Run (or Win+R) without having to type them into the CMD window or worry about the CMD console exiting prematurely. For example:

cmd /c hostname && w32tm /query /configuration && pause

Due to the aforementioned limitation though, this command will automatically exit the console window if w32tm fails - i.e.: If the Windows Time service is not running.

Is there a similar operator I can use to string commands together on one line, which will allow the second command to run even if the first errors out?

I'm looking for this to be compatible from Windows XP upward.

share|improve this question
up vote 12 down vote accepted

Just use & instead of &&. The second command will be executed even if the first one fails.

share|improve this answer
Here is the documentation for it:… – Oliver Salzburg May 23 '12 at 17:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .