locked
Why would a command line task not run? No errors reported either... RRS feed

  • Question

  • Hi all,

    MDT 2012 U1, I have as part of my Standard Client task sequence a Run Command Line task that I want to use to change some file attributes and rename a file. In my task I used the command line: attrib -h -s c:\myfile.ext & ren c:\myfile.ext myfile.newext & attrib -h -s. Basically it makes a hidden file unhidden, renames it, and then hides it again.

    This worked perfectly from the command line, yet when my task sequence runs, the file is not renamed. The task sequence does not throw any errors so I have no idea what is going wrong.

    Has anyone seen this behavior before? Am I doing something wrong? Any help would be much appreciated. Thank you!!

    Saturday, September 7, 2013 11:56 PM

Answers

  • "attrib" and "ren" are commands built into CMD.EXE, not executables. The task sequence engine tries to create a process with those as executables, but they can't be found, so the command line fails.

    To fix this, just prefix your command line with "cmd.exe /c ", which effectively says "start a process using CMD.EXE, have it run the commands specified, then exit."


    Thanks,
    -Michael Niehaus
    Senior Product Marketing Manager, Windows Deployment
    http://blogs.technet.com/mniehaus
    mniehaus@microsoft.com

    • Marked as answer by in2jars Sunday, September 8, 2013 1:36 PM
    Sunday, September 8, 2013 7:48 AM

All replies

  • Where in the task sequence do you run the commandline?
    Sunday, September 8, 2013 6:35 AM
  • "attrib" and "ren" are commands built into CMD.EXE, not executables. The task sequence engine tries to create a process with those as executables, but they can't be found, so the command line fails.

    To fix this, just prefix your command line with "cmd.exe /c ", which effectively says "start a process using CMD.EXE, have it run the commands specified, then exit."


    Thanks,
    -Michael Niehaus
    Senior Product Marketing Manager, Windows Deployment
    http://blogs.technet.com/mniehaus
    mniehaus@microsoft.com

    • Marked as answer by in2jars Sunday, September 8, 2013 1:36 PM
    Sunday, September 8, 2013 7:48 AM
  • "attrib" and "ren" are commands built into CMD.EXE, not executables. The task sequence engine tries to create a process with those as executables, but they can't be found, so the command line fails.

    To fix this, just prefix your command line with "cmd.exe /c ", which effectively says "start a process using CMD.EXE, have it run the commands specified, then exit."


    Thanks,
    -Michael Niehaus
    Senior Product Marketing Manager, Windows Deployment
    http://blogs.technet.com/mniehaus
    mniehaus@microsoft.com


    Thank you that seems to work!
    Sunday, September 8, 2013 1:36 PM