soleiman111
Posts: 1
Joined: Sat Jan 12, 2013 9:23 am

How to copy file into the AppData folder for each user?

I want copy file into the AppData folder for each user but installer only copy file into current user appdata folder
Example:
I want copy test folder in this location for two users(user1, user2)
C:\Users\user1\AppData\Roaming\<company>\test
C:\Users\user2\AppData\Roaming\<company>\test
I don't copy folder and file in this location
C:\ProgramData\<company>\test

Does anyone a solution for this problem?
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to copy file into the AppData folder for each user?

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve what you want you can create a per-machine installation type and, then add the related folder under "Application Data" folder in "Files and Folders" page.

Now you should create your application shortcut as an advertised shortcut and you should use the self healing feature to automatically install resources to per user location. Also, please make sure that in the "Organization" page the resource files components (from your test folder) are added under the same feature as your advertised shortcut component.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sujai.mca
Posts: 18
Joined: Mon Aug 18, 2014 6:55 am

Re: How to copy file into the AppData folder for each user?

Hi,
I need to copy a file to the current users folder. Is that possible?
Ex: c:\users\admin\custom_folder\mydata
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to copy file into the AppData folder for each user?

Hello,

Yes, you can do that. You can create a property based folder using a property having its value set to the desired path. Here are the steps to proceed:
1. go to "Install Parameters" page and add a new public property (e.g. MY_PROP)
2. go to "Files and Folders" page and create a property based folder using the "MY_PROP" property
3. go to "Custom Actions" page and add a "Set installer property" custom action with sequence, scheduled after "Wizard Dialogs Stage -> Searches" actions group, like this:
  • Property: MY_PROP
    Value: [WindowsVolume]Users\[LogonUser]\custom_folder\mydata
4. select the above custom action and, while keeping the [SHIFT] key pressed, drag and drop it under "Install Execution Stage -> Searches" actions group (the custom action will be shared between both execution stages)
5. build and test the project

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sujai.mca
Posts: 18
Joined: Mon Aug 18, 2014 6:55 am

Re: How to copy file into the AppData folder for each user?

Thank you...
I have tried in another method, can you tel me whether it's correct or not...

1. I created a property named "USER_PROPERTY" under "Custom Behavior -> Search -> New Search -> Search for Registry value -> HKEY_CURRENT_USER -> Volatile Environment -> USERPROFILE" then selected "Retrieve raw value". I have attached the picture of the property test result with the post.

2. This property returns the value of "C:\Users\UserName".

3. A new search is created under the Target computer named as "USER_PROPERTY".

4. Then i added a "New Property Based Folder" under "Target Computer" in "Files and Folders" and selected the "USER_PROPERTY".

5. Then i added the necessary files within the folder.

6. It works fine.

My doubt is will it work for all the users and in all the machines?
Attachments
Prop.jpg
Prop.jpg (48.08 KiB) Viewed 12131 times
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to copy file into the AppData folder for each user?

Hello,

I apologize for my delayed reply.

Your approach seems to be a valid one too. In order to make sure your setup package works fine on all environments it is highly recommended to perform a suite of installation tests. For testing purposes we always recommend to be used virtual machines with clean states, because if something goes wrong you can easily revert to a clean state of your virtual machine.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”