write a file to the users desktop in c#
I want to write a simple text file from my winform app in c# directly to the user's de开发者_运维知识库sktop and not be denied. How can I get the path? Thanks in advance.
Use Environment.SpecialFolder to get the path to the desktop. You may need to run elevated to write to this folder.
Edit: You also need to ensure that your administrative user has access to the desktop folder. For example:
精彩评论