Executing a batch file in a task sequence

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.

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top