How can I copy files from a package ? not as straightforward as you think

Let’s say you want to copy some files from a package to your target computer

In the following Task Sequence, copying files from packages – access.xml

we reference a package (called copy_files) which contains some blank files and folders

We have two groups in this simple task sequence, the first group copies all files from a package to a directory on your target computer (the computer that you run the task sequence on).

The first step in the group creates the target folder if it doesn’t exist, via a command line

cmd.exe /c md c:\somedir

To check if the folder already exists, you have to look at the options tab of that step

The second step actually copies the files by referencing our copy_files package, the clever part here is the .\ infront of our path.

so the command line to do the copying is as follows

xcopy.exe ".\*.*" "c:\somedir" /D /E /C /I /Q /H /R /Y /S

The second group in the task sequence is similar to the first except that it creates somedir2 and it only copies the TXT files from our selected package. (This is deliberate so that you can see what happens next..)

Note: In the
screenshot of the step above, I am deliberatly NOT including the .\ in
front of the path, this is to show you how an advertisements
distribution points settings can change the way command lines function.

the xcopy command in the second group is as follows

xcopy.exe "*.txt" "c:\somedir2" /D /E /C /I /Q /H /R /Y /S

See the entire post with screenshots here

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.