Windows – How to enter 2 commands on Windows command line

command linewindows

In the DOS command line, I used to be able to enter ¶ between commands to put multiple commands on one line.

For example, instead of typing

c:\> cls
c:\> cd

I could enter

c:\> cls¶cd

Has this functionality been removed or has this been replaced by something else?

How can I run multiple commands from one line?

Best Answer

Use &.

From the documentation:

command1 & command2 : Use to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command.

command1 && command2 : Use to run the command following && only if the command preceding the symbol is successful. Cmd.exe runs the first command, and then runs the second command only if the first command completed successfully.

command1 || command2 : Use to run the command following || only if the command preceding || fails. Cmd.exe runs the first command, and then runs the second command only if the first command did not complete successfully (receives an error code greater than zero).

(command1 & command2) : Use to group or nest multiple commands.

command1 parameter1;parameter2: Use to separate command parameters.

Related Question