Partager via


Inside the Run Command Line action

Once you have the basic Operating System Deployment process working with ConfigMgr 2007, you will likely want to begin customizing your task sequences.  The Run Command Line action provides a very flexible method to add custom steps.  There are a few things you should be aware of when developing Run Command Line steps.

Shell Commands

You need to prepend "cmd.exe /c" to internal shell commands (these are commands which are implemented by cmd.exe, such as dir and mkdir, instead of external executables, such as xcopy.exe).  Here is a list of the internal shell commands listed on Microsoft TechNet (http://www.microsoft.com/technet/archive/winntas/deploy/prodspecs/shellscr.mspx?mfr=true):

ASSOC CALL CHDIR/CD CLS
COLOR COPY DATE DIR
DPATH ECHO ENDLOCAL ERASE/DEL
EXIT FOR FTYPE GOTO
IF MKDIR/MD MOVE PATH
PAUSE POPD PROMPT PUSHD
REM RENAME/REN RMDIR/RD SET
SETLOCAL SHIFT START TIME
TITLE TYPE VER

Batch Files

Batch files ( .cmd and .bat) cannot run directly from a UNC path.  This can be an issue if you advertise the task sequence with the "Access content directly from the distribution point" option.

Missing Binaries

Window PE is a stripped-down version of the full operating system and does not have all of the same tools available as a full version of Windows.  You should verify that the Windows PE contains the binaries you require for your Run Command Line step.

Drive Letters

The drive letters are not always what you might expect them to be when running in Windows PE.  Whenever possible, use the variables set by ConfigMgr 2007, such as %OSDTargetDrive%, when you need to do things like access files on the local drive.

Contributed by Brett Flegg