2

I have some documents I want to install (using the Setup project) onto a Windows 7 system which is accessible by everyone. These documents should not be hidden. They should be visible for all users to double click on. I believe the best place for this is C:\Users\Public or C:\Users\Public\Documents.

Since there isn't a special folder for either of these folders in the Setup project, the only way I have found so far is to create a custom folder and set the DefaultLocation to [%public][Manufacturer][ProductName] etc.

(see http://community.flexerasoftware.com/archive/index.php?t-164246.html)

However, this seems very brittle; what if someone deletes the environment variable for public? Also, would this work on a different language version of Windows 7? Is there a better way to define the DefaultLocation to the Public folder for a Windows 7 install?

Jeb
  • 3,689
  • 5
  • 28
  • 45
  • Public didn't become available until Vista. SHGetKnownFolderPath to retrieve it. If you need to support XP then do consider just creating your own folder. Related: http://stackoverflow.com/questions/3795023/downloads-folder-not-special-enough – Hans Passant Dec 17 '10 at 17:37

1 Answers1

1

The public folder isn't stored in a standard environment variable (System -> Advanced -> Environment Variables) so I think it is very unlikely too many people are doing this, but I understand the need to create a robust installer.

This page has instructions on changing the location of the public folder. The accepted solution is quite involved and requires command line work. The suggestion by Luviana is much simpler. I would test them out and see if they break the %public% shortcut. My guess is that they will not. My best advice is to check it out for yourself and if it still works then you can count on the fact that %public% will be available.

mrtsherman
  • 39,342
  • 23
  • 87
  • 111
  • To fully answer your question - the environment variables will be the same across languages. So %public% will work. However, if you were after a subfolder then that could be different. For example %public%/music may have the music folder in a different language. I cannot think of a more robust means of specifying public than the system variable %public% – mrtsherman Dec 17 '10 at 16:41
  • Thanks mrtsherman, I imagine this also applies when programmatically referencing the public folder, e.g.: Directory = System.Environment.GetEnvironmentVariable("public") + "MyCompanyName" etc. ? – Jeb Jan 06 '11 at 10:35