授予程序更多访问权限

Ata*_*Ata 1 c#

有没有办法授予My Software对其文件夹的完全访问权限Program Files,当我运行Windows Vista或Windows 7并启用UAC时?

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

问候

Sco*_*ain 5

在程序文件文件夹中写入是不好的编程习惯,这就是微软让它变得如此困难的原因.一旦设置了程序,它就不应该触摸程序文件目录,除非它被修补.如果需要保存数据,则应将其写入文件夹

//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");
Run Code Online (Sandbox Code Playgroud)