Copy files to logged on user APPDATA profile

Hi All,
i need to copy 2 Powerpoint templates to all of our computers, and i am almost there, need your help for the finishing touch.
i have the task working fine up to the point of the actual copy, but since it should copy them to the users appdata\microsoft\templates folder, and the file has spaces in it (cant change it…), it fails:

the files are called “70 (16-9) template.potx” and “70 year Template.potx”, the copy command is this (for one of them…):

copy “__Download\70_templates\70 (16-9) template.potx” {concatenation of "c:\users" & name of current user & “\AppData\Roaming\Microsoft\Templates\70 (16-9) template.potx”}

the error is this:

Command failed (Copy of ‘C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\CustomSite_Workstations__Download\70_templates\70 (16-9) template.potx’ to ‘c:\users\test.user\AppData\Roaming\Microsoft\Templates\70’ failed (2)) copy “__Download\70_templates\ 70 (16-9) template.potx” c:\users\test.user\AppData\Roaming\Microsoft\Templates\70 (16-9) template.potx (action:213220)

so all i am missing is how to give the destination folder properly while still using {} and “”. can you give me some advise?

Hello!

It looks like your primary issue is related to the lack of quotes around the destination of your copy command.

If you look at the error:

We can see it’s copying from:

C:\Program Files (x86)\BigFix Enterprise\BES Client\_BESData\CustomSiteWorkstations\_Download\70templates\70 (16-9) template.potx

To:

c:\users\test.user\AppData\Roaming\Microsoft\Templates\70

With the remainder of the path being cut off because of the space in your path.

If you wrap your relevance substitution

In quotes:

"{concatenation of "c:\users\" & name of current user & "\AppData\Roaming\Microsoft\Templates\70 (16-9) template.potx"}"

It should work!

will try it, thanks!

That did the trick, thanks very much… i wasn’t sure i could wrap my relevance in quotes and still get it to work.

Thanks again!

Just think of the {} as being substitution boundaries, the relevance result will just be inserted into the string you made for the command

1 Like