Executing a batch file in a task sequence

by Mitch Tulloch [Published on 2 July 2015 / Last Updated on 2 July 2015]

A tip on getting a batch file to run in a task sequence in Microsoft Deployment Toolkit (MDT).

If you need to run an executable command like Dism.exe as a step of a task sequence when you are deploying Windows using Microsoft Deployment Toolkit (MDT), you can easily do this by adding a Run Command Line step in your task sequence by clicking Add, selecting General, and selecting Run Command Line.

However, what if instead of executing a single command like Dism.exe you want to execute a batch file like foo.bat that will run a whole series of commands? In that case, instead of just making your Run Command Line step execute this:

<path>\foo.bat

you should make it execute this instead:

cmd.exe /c <path>\foo.bat

otherwise your batch file may not run properly.

Mitch Tulloch is an eleven-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows Server and cloud computing technologies.  For more information see http://www.mtit.com.

See Also


The Author — Mitch Tulloch

Mitch Tulloch is a well-known expert on Windows Server administration and cloud computing technologies. He has published over a thousand articles on information technology topics and has written, contributed to or been series editor for over 50 books.

Featured Links