开发者

write a file to the users desktop in c#

开发者 https://www.devze.com 2023-03-24 23:54 出处:网络
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

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:

write a file to the users desktop in c#

0

精彩评论

暂无评论...
验证码 换一张
取 消