none
How to get the path of AppData folder of all the user's who had logged in to a particultar system?

    Question

  • I need to get the AppData folder of all the users who have logged in to a given a machine. I need this piece of code to work across both XP and Vista. I know we can get the list of user profiles from a registry entry in WinNT\CurrentVersion\ProfileList. But how do I proceed from here or am i choosing a wrong method. Pls suggest a method for achieving this.
    maha
    Friday, June 19, 2009 1:26 PM

All replies

  • What you need to do is to read the value from the registry key....

    This is Link from where you can proceed:

    Any probs let me know ;)










    Midnight Programmer
    Friday, June 19, 2009 2:01 PM
  • i know how to read frm a registry. After reading from registry i get each user's profile path. But for getting localSettings\AppData, i have to hardcode. In XP it is "C:\Documents and Settings\<UserName>\Local Settings\Application Data" and in Vista it is different.

    So i cant hard code the local settigns path as it varies from OS version to version.  How do i get the path of AppData local without hardcoding.

    maha
    Saturday, June 20, 2009 12:21 PM
  • Well in that case use this code:

    string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

    No matter what the OS you use it will work anyways.

    Cheers!

    Midnight Programmer
    Saturday, June 20, 2009 8:06 PM
  • Well, the Environment.SpecialFolder.ApplicationData only works for getting the current users profile. I would like to get the app data folder path of other users who had logged in to the machine. As the app data folder for vista and XP differ cant hard code any data over here.
    maha
    Monday, June 22, 2009 6:21 AM