Finding the local storage folder of a Windows 8 Style application

With some elementary investigation you can browse to your user folder, then dig your way down to the local storage folder for a WinRT applcation in the Explorer.  The path to these Windows 8 Style apps (formerly Metro) is as follows:

c:\Users\{username}\AppData\Local\Packages\Microsoft.BingSports_8wekyb3d8bbwe


 

 It all makes sense, but what is that mess on the end of the application name?  Interestingly enough it is a hash for the publisher of the application.  There is a new Windows API which uses an internal and undisclosed algorithm to create a publisher hash, which when appended to the package name becomes the family name.  Family name looks like {packagename}_{publisherhash}.  

So then, how would you programmatically access this if you aren't in a Windows 8 Style application you say?  Interesting question. 

If you wanted another desktop application or need to share this between some set of applications you can call the API via PowerShell cmdlet like so:

(Get-AppxPackage -AllUsers -Name  $name).PackageFamilyName

 

Write that to the registry and voila!  Your application can use Environment.UserName and the path pattern above to easily find your appx local storage.

comments powered by Disqus