When using Copy-File
, Robocopy is used by default instead of Copy-Item
in recent PSADT versions (3.10.x).
There seems to be a known bug in Robocopy which sometimes hides the destination folder. I experienced this when copying a .lnk file from the $envCommonDesktop
to $envCommonStartMenuPrograms
. After testing it seems to always occur when you copy anything from the public desktop to any destination.
In 3.10.1 there are override parameters for Robocopy so I solved it by using -RobocopyAdditionalParams '/A-:SH'
to fix this:
Copy-File -Path "$envCommonDesktop\AutoCAD Architecture 2024 - English (Swedish).lnk" -Destination "$envCommonStartMenuPrograms\AutoCAD Architecture 2024 - English\" -RobocopyAdditionalParams '/A-:SH'