Missing environment variable ALLUSERSPROFILE? - Programmer

This is a discussion on Missing environment variable ALLUSERSPROFILE? - Programmer ; I'm developing a program that stores data for all users in the location pointed to by the environment variable ALLUSERSPROFILE. Problem I am seeing is that some users don't seem to have this variable set in their environment, which causes ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Missing environment variable ALLUSERSPROFILE?

  1. Missing environment variable ALLUSERSPROFILE?

    I'm developing a program that stores data for all users in the
    location pointed to by the environment variable ALLUSERSPROFILE.

    Problem I am seeing is that some users don't seem to have this
    variable set in their environment, which causes my program to crash.
    (arrrrrgggggg....)

    Anyone know:

    1. Why is it sometimes missing (does not seem to be version specific,
    I'm seeing it on XP SP 2 machines, as well as other computers).

    2. Best work around? I know about

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Explorer\Shell
    Folders

    and can access that if necessary, but would like the 'best' or
    accepted way if possible.

    Suggestions?

  2. Re: Missing environment variable ALLUSERSPROFILE?

    use the API to retrieve it?
    may be SHGetSpecialFolderLocation() or WSH?

    On Wed, 06 Feb 2008 08:38:54 -0500, PeterD wrote:

    >I'm developing a program that stores data for all users in the
    >location pointed to by the environment variable ALLUSERSPROFILE.
    >
    >Problem I am seeing is that some users don't seem to have this
    >variable set in their environment, which causes my program to crash.
    >(arrrrrgggggg....)
    >
    >Anyone know:
    >
    >1. Why is it sometimes missing (does not seem to be version specific,
    >I'm seeing it on XP SP 2 machines, as well as other computers).
    >
    >2. Best work around? I know about
    >
    >HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Explorer\Shell
    >Folders
    >
    >and can access that if necessary, but would like the 'best' or
    >accepted way if possible.
    >
    >Suggestions?



  3. Re: Missing environment variable ALLUSERSPROFILE?

    On Thu, 07 Feb 2008 02:47:23 -0800, Josh Assing
    wrote:

    >use the API to retrieve it?
    >may be SHGetSpecialFolderLocation() or WSH?
    >
    >On Wed, 06 Feb 2008 08:38:54 -0500, PeterD wrote:
    >
    >>I'm developing a program that stores data for all users in the
    >>location pointed to by the environment variable ALLUSERSPROFILE.


    Yes, that is the best solution. I'd really like to know as well why it
    is missing on some computers, however. Just kinda bugs me...

    (Thanks for the reply!)

+ Reply to Thread