SpecialFolder.MyDocuments giving correct value in a console application but not on a Windows Service
问题 I have a windows service running on my machine. When I do a Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) it gives me empty string but when I do the same thing in a console application it gives me the correct location of my MyDocuments folder. Any ideas as to why it might be happening? 回答1: That is because when you run the application as a Console you are running signed in to the computer as you, the user, and can therefore access your "My Documents". When the