Run Multiple Commands from a Single Run Command Line Task in an SCCM 2012 Task Sequence

When building an SCCM 2012 task sequence, a Run Command Line task can be added to execute CMDs:


When needing to run multiple commands, adding a separate Run Command Line tasks for each command will work.  But sometimes combining multiple commands into a single step will be more efficient.

The & Operator

Two or more commands can be ran within one Run Command Line task by separating commands with the & (AND) operator.  For example, the following command will make a directory and then copy a file to it:

md C:\Temp & copy file.txt C:\Temp\file.txt


You can also utilize && and ||

There are a couple of additional conditional execution operators that can be useful.

Using && (IF) means execute the first command and run the second if it succeeds, which might have been a better idea for the example given above.

Using || (OR) means only execute the second command if the first one fails.

All these same operators can also be used when executing commands from a regular Windows command prompt.  Use these techniques to clean up and optimize task sequences that run multiple commands.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: