Copy Files And Deleting Shortcuts

Hello and thank you for your assistance. Here is the scenario. I have created a folder in the Support File Directory. I put multiple files in there and i am trying to copy all of those files in to a particular directory. My code is as follows.

Copy-File -Path “$dirSupportFiles\Project*.*” -Destination "$envProgramFilesX86\Hewlett Packard Enterprise\Records Manager"

How ever for some reason files are not being copied. I have an additional file that lives in the root of the SupportFiles directory that i need to copy to temp folder. My code is as follows.

Copy-File -Path “$dirSupportFiles\projects.xml” -Destination “$envUserProfile\AppData\Local\Temp” (just want to make sure that this code looks good)

Last thing is (and i am completely at a loss here) i need to delete a few icons from the desktop of the current user. I can’t find a code on how to do that. Any help would be appreciated. Thank you!

To delete files use Remove-File command.


For the first copy-file command, are you trying to copy a folder or files within the folder. If the latter, you’re missing a backslash. > Project\*. *

For the additional question on how to delete items from the ‘logged in user’ account’s desktop; you can use the $envUserDesktop variable.