Help with Run Command Line RRS feed

  • Question

  • Hi Guys,

    In my deployment share I have made a batch file script to copy some desktop icons and favorites to the PC's public profile after the OS and applications have installed. However I am not getting the script to work.  I know this works if I add the batch file as an application but that's not an option as it will look messy.

    My files are located here: \\servername\deploymentshare$\user files\profile shortcuts

    Command Line: cmd \c "%DEPLOYROOT%"\user files\profile shortcuts\copyfiles.bat

    Start In: "%DEPLOYROOT%"\user files\profile shortcuts\copyfiles.bat

    However LiteTouch throws a series of failed error messages. Can anyone help?

    Tuesday, April 15, 2014 2:50 PM

All replies

  • Hi,

    try this: cmd \c "%DEPLOYROOT%\user files\profile shortcuts\copyfiles.bat"

    Start in: <leave blank>

    Also I would suggest to rename your bat file to *.cmd and use "%~DP0" in your CMD file. That sets the working directory and can copy the shortcuts without a problem.


    xcopy "%~DP0*.*" C:\User\Public\Desktop /E /I /Y

    Good luck!

    If this post is helpful please click "Mark for answer", thanks! Kind regards

    Tuesday, April 15, 2014 2:55 PM
  • Hi Rens,

    Thanks for your reply.

    In my profile shortcut's folder I have two folders: a Desktop folder and a Favorites folder. My cmd runs the following commands:

    xcopy Desktop C:\Users\Default\Desktop

    xcopy Favorites C:\Users\Public\Favorites

    In this case how would I use %~DP0

    • Edited by Costamh Tuesday, April 15, 2014 3:30 PM
    Tuesday, April 15, 2014 3:19 PM
  • Like this:

    xcopy "%~DP0\Desktop\*.*" C:\User\Default\Desktop /E /I /Y
    xcopy "%~DP0\Favorites\*.*" C:\User\Public\Favorites /E /I /Y

    Try the CMD first before using it into the task sequence.

    Mount your deploymentshare to Z:\ and browse from an elevated command prompt to the directory where your cmd is located, then call the cmd and let it execute to see if everything works.


    If this post is helpful please click "Mark for answer", thanks! Kind regards

    Tuesday, April 15, 2014 4:49 PM
  • Thanks Rens,

    I have updated the command. The issue is I can seem to get MDT to access the location  "%DEPLOYROOT%\user files\profile shortcuts\copyfiles.bat" I have also tried with z:\user files\profile shortcuts\copyfiles.bat

    I am wondering if MDT will actually allow a task sequence step to run from a folder that is not initially created in the deploymentshare by MDT.

    Tuesday, April 15, 2014 6:09 PM
  • Hi,

    I see you have missed something in your commandline: "%DEPLOYROOT%\user files\profile shortcuts\copyfiles.bat"

    Needs to be: "%DEPLOYROOT%\Applications\<Name Of Your Application Folder>\copyfiles.cmd"

    And then in that same directory you have the two subfolders: .\Desktop and .\Favorites

    DeployRoot points to your deployment share, underneath that folder you have multiple folders like $OEM$, Applications, Control etc. So you need to mention those folders too! Only %SCRIPTROOT% has an direct 'entry' that points to DeploymentShare\Scripts.


    If this post is helpful please click "Mark for answer", thanks! Kind regards

    • Proposed as answer by LuisFlores3 Tuesday, March 17, 2015 7:50 PM
    Tuesday, April 15, 2014 6:18 PM
  • Thanks,

    That's my questions. In the root of the deploymentshare I have created a folder called User Files. I guess MDT litetouch task sequence will not go to that directory because it is not a folder originally created by MDT. 

    So I guess what I will have to do is move the user files folder from the root into the applications folder and then test if that will work. 


    Tuesday, April 15, 2014 6:55 PM