v3.10-Copy-File - Cannot find path '$dirFiles' because it does not exist

Hi,

We're still using PSADT 3.10 and we ran into an issue today. In one of our deployments, we need to copy a license file as a post-installation task. The license is added to the folder "Files" in the PSADT structure.
When we ran the script, we noticed that the file wasn't copied to the location. In the log file we found an error message.

[Post-Installation] :: Failed to copy file(s) in path [$dirFiles\filename.lic] to destination [Destination path]
Error Record:
-----------------------

Message : Cannot find path "$dirFiles" because it doesn't exist.

Obviously we're doing something wrong and we've also tried the SupportFiles folder, but we got the same error message.

Any idea what we are doing wrong?

can you at least post the command line?

I think we'd need to see some of your code to give us an idea of what the issue is
Can you share as a minimum the line where the copy occurs?
Remember to insert your code using the Preformatted Text (Ctrl+E) button on the Toolbar </> on this forum.

This is the command we use and lic-file is located in the Files folder.

Copy-File '$difFiles\3DVS.lic' -Destination 'C:\Program Files\Kisters\3DViewStation'

I'm hoping it's a copy / paste error, but your $dirFiles variable is spelled incorrectly:

Copy-File '$difFiles\3DVS.lic' -Destination 'C:\Program Files\Kisters\3DViewStation'

it should be:

Copy-File '$dirFiles\3DVS.lic' -Destination 'C:\Program Files\Kisters\3DViewStation'

No, it's a typo that I've made. I've actually typed the path you gave.
I've also tried

Copy-File '$supportFiles\3DVS.lic' -Destination 'C:\Program Files\Kisters\3DViewStation'

Ah! I've just realised, you have a variable inside single quotes - This won't get expanded, you need to use double quotes. I'd also recommend you wrap variables in $() incase the expanded content (path) contains spaces.
So your command 'should' now look like this:

Copy-File "$($dirFiles)\3DVS.lic" -Destination 'C:\Program Files\Kisters\3DViewStation'

That solved the issue.

Thank you sir!