title: Get user root directory from windows service
body: <p>I have a Windows Service written in C#.  I need to add a file to each user directory.  How can I find the path to start in?  I realize this is really dumb but this is what I'm currently doing:</p>
  
  <pre><code>  if (Directory.Exists("C:\\Users"))
    {
      path = "C:\\Users";
    }
    else if (Directory.Exists("C:\\Documents and Settings"))
    {
      path = "C:\\Documents and Settings";
    }
  </code></pre>
  
  <p>I've looked at the special folders: <a href="http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx</a></p>
  
  <p>None of them seem to return what I need.  For example, ApplicationData is returning the path to the System32 directory.  I presume this is because it is running as a windows service.  The code I'm currently using works for the few tests I've done.  It just seems like there should be a more intelligent (error proof) way of getting this path.</p>
  
  <p>Another thought...maybe there is a registry key that will give me what I'm looking for?  Hmmm</p>