4

a customer's I have some applications that are installed with plain xcopy. I know those applications will write some data into their installed directory at runtime. Now I want this application to be available for all users on my PC from the start menu. Where do I put these app under windows 7? Is it still "c:\Program Files" ? If so wouldn't the apps need admin rights to write to that directory? Is this where roaming kicks in? If so, how can I prevent the app from writing to a special per-user roaming folder and instead make it write to the ONE folder the exe is in?

Update (rephrasing the question):

What is the suggested/preferred/official way to deploy an application (just a folder with an exe and some extra files) to a customer's Windows 7 PC, so that:

  1. it will be available to all users (everybody can doubleclick the exe or a shortcut to it)
  2. there is only one instance of the files (not a copy for each user)
  3. the exe can read and write to the same physical folder it resides in (so that it reads the same files, no matter what user is running the app)
  4. no UAC dialog asking for privileged rights pops up when the exe is run (the exe iteself doesn't do anything that'd require this)
bitbonk
  • 476

4 Answers4

3

If you want an application to be accessible for all users, it should be installed in the Program Files directory (Program Files (x86) where applicable.)

The application will not be able to write to the folder it is installed in though, unless started with elevated privileges (which you don't want). And doing so would be a bad idea anyway. You should never want to do this.

Instead, you'll want to write user-specific files to their profile folders. Depending on what you want, you would either write the data to the Roaming or Local user data folders. If you don't know, then ask yourself how the application should behave in a domain environment. Generally, the Roaming profile (as the name implies) travels with the user to other workstations. If that isn't desirable for your application, use the Local profile.

If you absolutely need to have shared data that all users need to be able to read and write, then simply don't place it in the installation directory (for writing). Upon startup of your application, check if the file exists in the local profile of the Public user. If it doesn't, copy the file there from your installation directory and then use the copy from thereon.

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
1

It is better in such cases to stay out of C:\Program Files, or C:\Program Files (x86) for 32-bit programs, because of the special permissions in force on these folders.

It is much simpler to copy the application to some other folder and give the Users group all the necessary permissions on that folder.

It is easy enough to create a shortcut to the exe, that you could either :

  • leave in the directory
  • copy to the user's desktop
  • drop onto the user's Start menu
  • copy to the all-users Start menu that is normally found in
    C:\ProgramData\Microsoft\Windows\Start Menu.

The last option might be the simplest to put in place.

harrymc
  • 498,455
1

What is the suggested/preferred/official way to deploy an application (just a folder with an exe and some extra files) to a customer's Windows 7 PC, so that:

The suggest/preferred/official way is not do what you are wanting to do. The prefered way to install 32-bit programs that are accessible by all users is to install into the 32-bit Program Files folder. The guidance is that any app data should be written to the CommonAppDataFolder folder.

Your requirements are contradictory to the official guidance and you should reconsider your requirements. Here is the official guidance from Microsoft:

heavyd
  • 65,321
0

You could leave it in C:\Program Files, just change permissions on the program's folder to give the other users the appropriate access rights in the ACL. You'll want to turn off inheritance from the parent folder and manually add the user "Everyone" with the permissions you want everyone to have.