除了没有管理权限的 LOCALMACHINE -Registry 之外,我可以在哪里放置普通用户数据 [英] Where can i place common user data other than LOCALMACHINE -Registry without Administrative Rights

查看:48
本文介绍了除了没有管理权限的 LOCALMACHINE -Registry 之外,我可以在哪里放置普通用户数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在除注册表 -localmachine 之外的 Windows 中,我可以在哪里放置所有用户都可以访问的公共用户数据.

In Windows other than the registry -localmachine where can I place common user data that could be accessed by all users.

我需要这样做无需请求提升管理员权限

i need to do this without requesting elevation of admin rights

推荐答案

您可以将其存储在应用程序数据文件夹中.您可以从 Envorinment 获得:

You can store it in the Application data folder. which you can get from Envorinment:

var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);

要确定是否可以在没有管理员权限的情况下访问该文件夹,请在没有管理员权限的情况下运行 Visual Studio,然后查看此代码是否成功执行.

To determine if you can access the folder without admin right, run Visual Studio, without admin rights, and see if this code executes successfully.

   class Program
    {
        static void Main(string[] args)
        {
            var folder = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);
            var file = Path.Combine(folder, "testfile.txt");

            File.WriteAllText(file, " Test Settings");
            Console.ReadLine();
        }
    }

这篇关于除了没有管理权限的 LOCALMACHINE -Registry 之外,我可以在哪里放置普通用户数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆