Commands From a Task Sequence

Running commands from a task sequence is easy enough, although for the last couple of days I've been wrestling with an issue of a task command which just doesnt want to run;

copy \\server\file.txt c:\folder\destination\

Strangly enough bringing the console up (F8) and running the command manually it works fine.

After much searching and some help from the MS Technet guys, there is a simple solution.

If you want to run any windows inbuilt command line from a task sequence you must insert "cmd /c" at the start of the statement. So;

copy \\server\file.txt c:\folder\destination\

becomes;

cmd /c copy \\server\file.txt c:\folder\destination\

So this includes functions such as copy, move, rename....basically anything which doesnt have an exe file. As an alternative, you could download a free command line for the appropriate action.... for example there are lots of free command line copy utilities out there which could be used as an alternative to the cmd /c copy command, in the form of an exe.

Its worth pointing out that each time you run cmd /c its running in its own memory space....so dont expect to be able to register variables or anything fancy as you will run into problems!

0 comments: