My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

Does anyone know if there is a way to get to the current users application data folder I've tried:
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

But it add's on what VB would call my program name, plus the version number.

I need to be able to access a folder I created in a previous version of my program which is located in a folder off the current users application data folder.



Answer this question

My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

  • Hartley

    Hmm..I tried it out myself and found the same thing. That's strange. Donno why it would do that. Anyway, you can do this to get the "Application Data" and the "Local Settings\Application Data":

    System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

    System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

    hope that helps,
    Imran.

  • Farpetrad

    Thanks, I'll give it a try.

    Is it safe to assume 'Environment.SpecialFolder.ApplicationData' would be all users, and 'Environment.SpecialFolder.LocalApplicationData' would be the current user


  • Harish

    Definately, thanks again.
  • mike1942f

    Here's what the values are:

    SpecialFolder.ApplicationData - is the application data folder for the current user
    SpecialFolder.CommonApplicationData - is the application data folder for all users
    SpecialFolder.LocalApplicationData - is the application data folder under "Local Settings" for the current user.

    So let's say your windows is installed on drive C:\ and the the local user name is "myUser". Here's what the values look like with System.Environment.GetFolderPath when using the above 3 enum values:

    System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) - C:\Documents and Settings\myUser\Application Data

    System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) - C:\Documents and Settings\All Users\Application Data

    System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) - C:\Documents and Settings\myUser\Local Settings\Application Data

    hope that helps,
    Imran.

  • My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData