Directory Configuration in C#

83 views Asked by At

I would like to read from a htm file, that is located to the following directory:

C:\Users\**NAME**\AppData\Roaming\Microsoft\Signatures

How can I change the path, so that I can use it from another computer, where the user name is not equal to the one above?

DirectoryInfo directoryInfo = new DirectoryInfo(Environment.SpecialFolder.ApplicationData + @"Roaming\Microsoft\Signatures");
2

There are 2 answers

0
James On BEST ANSWER

Environment.SpecialFolder is an enumeration, you need to call GetFolderPath to get the actual path. Also ApplicationData includes the "Roaming" part, so you don't need that

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Signatures"
0
daniele3004 On

Try this:

  Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData,Environment.SpecialFolderOption.None) + @"\Microsoft\Signatures"

Check also the possibility of parameter Environment.SpecialFolderOption