I have a problem getting the Current windows logged user desktop folder when running windows service application under "Local System". when I try to use:
Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
i get an empty string (I guess because i'm running the service under "Local System").
this is my OnStart function:
protected override void OnStart(string[] args)
{
System.Diagnostics.Debugger.Launch();
//Get the current user desktop path;
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string filter = "*.*";
// create the watcher.
FileSystemWatcher watcher = new FileSystemWatcher(path, filter)
{
EnableRaisingEvents = true,
IncludeSubdirectories = true
};
//listen to the change event;
watcher.Changed += watcher_Changed;
//Thread.Sleep(Timeout.Infinite);
}
Is there a way to get the current logged windows user path?
Thanks.