3

I'm trying to access Windows XP's Application Data - but I'm having a slight issue, I am using the following code:

 Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

This is working correctly in any other opperating system - but Windows XP - On Windows XP it directs them to: C:\Documents and Settings\Administrator\Application Data - this is not the folder I want.

I want to access: C:\Documents and Settings\Administrator\Local Settings\Application Data

I have tried to do:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\..\Local Settings\Application Data - but I am getting .NET 'File Not Found' Errors.

What should I do? Please and Thank You!

Ry-
  • 218,210
  • 55
  • 464
  • 476
Alex
  • 1,398
  • 4
  • 15
  • 19
  • When combining paths, always use [`System.IO.Path.Combine`](http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx) regardless, because it will compensate for slashes and roots without complicated method calls: `IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "..\Local Settings\Application Data")` (Converted from 2011-11-29 answer.) – Ry- Sep 04 '12 at 14:31

3 Answers3

7

I think what you are looking for on XP is Environment.SpecialFolder.LocalApplicationData.

drew010
  • 68,777
  • 11
  • 134
  • 162
3

Try using the Environment.SpecialFolder.LocalApplicationData.

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
Simon
  • 1,211
  • 9
  • 5
-1

remove the "\.." Try this:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Local  Settings\Application Data
Robert
  • 3,074
  • 3
  • 24
  • 32
  • I want to go back a folder to get to the User's Folder - then to Local Settings\Application Data. There isn't a Local Settings folder inside Applications Folder. Because apparently there are two different Application Folders. – Alex Nov 29 '11 at 03:28
  • Ah sorry about that, I missed the Administrator user in the path :) @Simon's solution looks to be the right one. – Robert Nov 29 '11 at 03:32