使用目录访问系统文件 [英] Accessing System Files with Directory

查看:136
本文介绍了使用目录访问系统文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

我试图编写一个控件,以显示指定目录中的所有文件和文件夹.如果文件夹引发UnauthorizedAccessException,则无法在控件中显示该文件夹.

我已经提高了管理员的运行权限,并使用了可以确认我以管理员身份运行该程序的代码.

我必须以编程方式提升失踪的权利吗?

谢谢.

Hello.

I am trying to write a Control that displays all files and folders in a specified directory. If a folder throws an UnauthorizedAccessException, I can''t display that folder in my Control.

I have heightened the running permissions to administrator, and have employed code that confirms that I am running the program as an administrator.

Is there a different way I have to elevate my rights programmatically that I am missing?

Thanks.

推荐答案

您不应该以编程方式提升权限(我认为Windows不允许).
You shouldn''t elevate permissions programatically (and I don''t think Windows will allow it).


有很多原因,如果您收到UnauthorizedAccessException,则不应该显示文件夹.你为什么要如果您是用户Jack,您希望该用户能够在Judy的命名空间中查看文件吗?
There are a lot of reasons that you shouldn''t show a folder if you get an UnauthorizedAccessException. Why would you want to? If you''re user Jack, you want that user to be able to see the files in Judy''s namespace?


如果我是用户管理员,我希望每个人的一切.
If I''m user Administrator, I''d want everyone''s everything.


这篇关于使用目录访问系统文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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