How to execute multiple commands in a single line

WindowsCmd

Windows Problem Overview


I know Unix has the following command which can execute multiple commands in a single line, how can I do this in DOS?

command1 ; command2 ; command3 ...

Windows Solutions


Solution 1 - Windows

Googling gives me this:


Command A & Command B

Execute Command A, then execute Command B (no evaluation of anything)


Command A | Command B

Execute Command A, and redirect all its output into the input of Command B


Command A && Command B

Execute Command A, evaluate the errorlevel after running and if the exit code (errorlevel) is 0, only then execute Command B


Command A || Command B

Execute Command A, evaluate the exit code of this command and if it's anything but 0, only then execute Command B


Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionzddView Question on Stackoverflow
Solution 1 - WindowsSidRView Answer on Stackoverflow