0

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");
pnuts
  • 58,317
  • 11
  • 87
  • 139
sjantke
  • 605
  • 4
  • 9
  • 35

2 Answers2

1

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"
James
  • 9,774
  • 5
  • 34
  • 58
0

Try this:

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

Check also the possibility of parameter Environment.SpecialFolderOption

daniele3004
  • 13,072
  • 12
  • 67
  • 75