Copy File to Users App Data

Hello i am new to this application and i am looking for some help. i am trying to copy multiple files from the support files directory to AppData of currently logged in user. my code is as follows.

Copy-File -Path “$dirSupportFiles\deployment.properties” -Destination
“$envUserAppData\LocalLow\Sun\Java\Deployment”

and

Copy-File -Path “$dirSupportFiles\version.xml” -Destination
"$envUserAppData\Roaming\Oracle\SmartView\

none of the pieces of code seems to be working. i am thinking that my declaration of the enviornment is wrong, but i can not find a correct one. Please assist :slight_smile:

This is how i do it where i work… You may have to change some stuff to work for you…

$Value = Get-WMIObject -class Win32_ComputerSystem | select username
$Junk, $UserName = $Value –Split “\\”
$UserName = UserName –replace "."

**Ok no idea why it looks to be removing it but the last command is “period then dollar sign”

Hope this helps

I am not an expert but how is this copying files?

Basically after running this you can then use it to define the path…

C:\Users$UserName\Path to what you want.

If what you get from $Value returns something like Domain\Username

We might be talking about two different things here. I have two files in the Support File directory. From the Admin Guide i understand that i need to do this. Copy-File Copy-File -Path “$dirSupportFiles\deployment.properties” Depoloyment.properties is the actual file that needs to be copied. for the destination it needs to go to AppData\LocalLow\Sun\Java\Deployment folder of the current user. This is post-install action. I am not following how the code that you provided is going to help me. In batch file i can use %USERPROFILE%\AppData\LocalLow\Sun\Java\Deployment\ and it does the trick.

Why not take a step back and use $envUserProfile variable instead? This would change your destination paths to:
“$envUserProfile\AppData\LocalLow\Sun\Java\Deployment”
“$envUserProfile\AppData\Roaming\Oracle\SmartView”

Thank you!!! Seems to be working perfectly :slight_smile: