gpt4 book ai didi

c# - 授予程序更多访问权限

转载 作者:太空宇宙 更新时间:2023-11-03 20:38:47 24 4
gpt4 key购买 nike

当我运行 Windows Vista 或 Windows 7 并启用 UAC 时,是否有任何方法可以授予我的软件对其在 Program Files 中的文件夹的完全访问权限?

我的应用程序无法在 Program File 中写入或删除它的文件!

问候

最佳答案

在程序文件夹中写入是糟糕的编程习惯,这就是微软如此难以做到的原因。一旦程序设置完成,除非正在修补,否则永远不要触及程序文件目录。如果需要保存数据应该写入文件夹

//Use this if you want different folder per user
Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData),"Your Application Name");

//Use this if you want the same folder per user
Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.CommonApplicationData),"Your Application Name");

关于c# - 授予程序更多访问权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3942653/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com