The question title is seemingly straight forward and self-explanatory. The issue is that the SpecialFolders enumeration does not include Libraries Folder and I really need to access it and display its folders in a ListBox. Is there any way to do this please?
Asked
Active
Viewed 322 times
0
-
Can you give us your code to improve it? – Lamloumi Afif Jul 03 '14 at 12:50
-
Does [this article](http://www.codeproject.com/Articles/65535/Windows-Libraries-C-Quick-Reference) help? – D Stanley Jul 03 '14 at 12:51
1 Answers
3
The path to the Libraries folder is %APPDATA%\Microsoft\Windows\Libraries
, you can use SpecialFolder.ApplicationData
, which on Windows is the same as the %APPDATA%
environment variable:
var appData = Environment.GetFolderPath(
Environment.SpecialFolder.ApplicationData);
var librariesFolder = Path.Combine(appData, @"Microsoft\Windows\Libraries");
Another way to get the full path is to just expand the environment variable:
var librariesFolder = Environment.ExpandEnvironmentVariables(
@"%APPDATA%\Microsoft\Windows\Libraries");
Anyways, this is Windows specific and won't work on other platforms, which is pretty much the single good reason to use Environment.SpecialFolder
in the first place.

khellang
- 17,550
- 6
- 64
- 84