SOLVED

Using variables in Folder Redirection

%3CLINGO-SUB%20id%3D%22lingo-sub-2888972%22%20slang%3D%22en-US%22%3EUsing%20variables%20in%20Folder%20Redirection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2888972%22%20slang%3D%22en-US%22%3E%3CP%3EI%20want%20to%20redirect%20a%20text%20file%20from%20AppDir%20to%20the%20users%20Appdata%20folder.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20advanced%20installer%20I%20have%20setup%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3EFolder%3C%2FSTRONG%3E%3A%20APPDIR%3C%2FP%3E%3CP%3E%3CSTRONG%3EFile%20Name%20Pattern%3C%2FSTRONG%3E%3A%20.%5C.*txt%3C%2FP%3E%3CP%3E%3CSTRONG%3EDestination%3C%2FSTRONG%3E%3A%26nbsp%3Bc%3A%5Cusers%5C%26lt%3B%3CEM%3Emyusername%3C%2FEM%3E%26gt%3B%5CAppdata%5CRoaming%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20the%20MSIX%20works%20fine%20for%20me%20but%20not%20for%2015.000%20other%20users.%20So%20I%20would%20like%20to%20use%20a%20variable%20in%20Destination.%26nbsp%3B%20So%20far%20I%20have%20tried%20and%20failed%3A%3C%2FP%3E%3CP%3E%25appdata%25%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3C%2FP%3E%3CP%3E%5BAppDataFolder%5D%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3CBR%20%2F%3EAppDataFolder%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3CBR%20%2F%3E%25AppDataFolder%25%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3CBR%20%2F%3E%5B%25AppDataFolder%25%5D%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3CBR%20%2F%3E%5BAppDataFolder%25%5D%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3CBR%20%2F%3E%5BAPPDATAFOLDER%5D%5C%26lt%3B%3CEM%3Evendor%3C%2FEM%3E%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20tell%20me%20what%20the%20convention%20is%20to%20get%20a%20variable%20in%20the%20Destination%20path%20name%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2896469%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20variables%20in%20Folder%20Redirection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2896469%22%20slang%3D%22en-US%22%3EWhen%20running%20inside%20of%20the%20container%20any%20code%2C%20including%20PSF%20based%20code%2C%20that%20attempts%20to%20write%20to%20the%20user's%20Appdata%20(by%20which%20I%20assume%20you%20mean%20C%3A%5CUsers%5CUsername%5CAppData%5CRoaming)%20folder%20will%20end%20up%20redirected%20by%20the%20lower%20level%20code%20back%20to%20the%20package%20area%20for%20the%20folder%20under%20LocalAppData.%20And%20there%20is%20nothing%20the%20PSF%20can%20do%20about%20it.%20%3CBR%20%2F%3E%3CBR%20%2F%3EBut%20presumably%20the%20user's%20system%20has%20something%20redirecting%20the%20roaming%20data%20and%20you%20can%20target%20that%20location%20directly%20instead.%20%3CBR%20%2F%3E%3CBR%20%2F%3EMaybe%20it%20is%20a%20home%20drive%2C%20maybe%20it%20is%20mounted%20drive%2C%20those%20are%20easy%20and%20presumably%20advanced%20installer%20has%20an%20option%20that%20would%20do.%20%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20it%20is%20a%20profile%20redirection%20system%20implemented%20as%20a%20filter%20driver%20(UEV%2C%20AppSense%2C%20FsLogix%2C%20but%20not%20Roaming%20Profiles%20or%20Folder%20Redirection%20)%20you%20can%20ask%20ai%20to%20redirect%20to%20LocalAppData%20and%20train%20the%20configuration%20rules%20of%20the%20filter%20driver%20to%20pick%20it%20up%20from%20the%20package%20LocalAppData%20after.%3C%2FLINGO-BODY%3E
Visitor

I want to redirect a text file from AppDir to the users Appdata folder.

 

In advanced installer I have setup:

Folder: APPDIR

File Name Pattern: .\.*txt

Destination: c:\users\<myusername>\Appdata\Roaming\<vendor>

 

Then the MSIX works fine for me but not for 15.000 other users. So I would like to use a variable in Destination.  So far I have tried and failed:

%appdata%\<vendor>

[AppDataFolder]\<vendor>
AppDataFolder\<vendor>
%AppDataFolder%\<vendor>
[%AppDataFolder%]\<vendor>
[AppDataFolder%]\<vendor>
[APPDATAFOLDER]\<vendor>

[APPDATAFOLDER]<vendor>

[AppDataFolder]<vendor>

[AppDataFolder]'\<vendor>'
[AppDataFolder]+'\<vendor>'
[AppDataFolder]&\<vendor>

 

Can anyone tell me what the convention is to get a variable in the Destination path name?

1 Reply
best response confirmed by siebrasse (Visitor)
Solution
When running inside of the container any code, including PSF based code, that attempts to write to the user's Appdata (by which I assume you mean C:\Users\Username\AppData\Roaming) folder will end up redirected by the lower level code back to the package area for the folder under LocalAppData. And there is nothing the PSF can do about it.

But presumably the user's system has something redirecting the roaming data and you can target that location directly instead.

Maybe it is a home drive, maybe it is mounted drive, those are easy and presumably advanced installer has an option that would do.

If it is a profile redirection system implemented as a filter driver (UEV, AppSense, FsLogix, but not Roaming Profiles or Folder Redirection ) you can ask ai to redirect to LocalAppData and train the configuration rules of the filter driver to pick it up from the package LocalAppData after.