如何在具有完全权限的C:\ Windows \ System32中写入文件 [英] How to write files in C:\Windows\System32 with full permissions

查看:612
本文介绍了如何在具有完全权限的C:\ Windows \ System32中写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Iam使用Winforms开发POS软件. Iam尝试以编程方式将XML文件(其中包含一些有关软件序列号的加密信息)写入C:\ Windows \ System32目录.但是当我写的时候我得到一个错误,访问被拒绝.

Iam working on POS software using winforms. Iam trying to programmatically writing XML file (which contain some encrypted information about software serial number) to C:\Windows\System32 directory. But when i write i get an error Access denied.

任何人都可以解释一下如何在Windows 7和Windows XP的此目录中以完全权限写入此文件吗?

Can anyone please explain how can i write this file with full permissions in this directory in windows 7 as well as in windows XP???

任何其他建议或更好的方法也将受到欢迎.

Any other suggestion or better way to do this will also be welcome.

谢谢.

推荐答案

您需要成为计算机的管理员才能写入Windows目录.此外,在Vista和更高版本上,您的过程将需要提升"(否则称为以管理员身份运行").您可以在应用程序的属性表中进行配置,如此处所述,或需要更多工作,以编程方式进行.

You'll need to be an administrator on the machine to write to the Windows directory. In addition, on Vista and later, your process will need to be "elevated" (otherwise known as Run As Administrator). You can configure this on your application's property sheet, as discussed here, or with a bit more work, do it programmatically.

尽管所有(误导的)软件都执行该操作,但这是一种不好的做法.将文件保存在其他位置. %appdata%或%localappdata%(专门用于应用程序数据的目录)是不错的选择.

It's bad practice to write to that directory, though, notwithstanding all the (misguided) software that does that. Save your files somewhere else. %appdata% or %localappdata% (directories specifically meant for application data) are good choices.

这篇关于如何在具有完全权限的C:\ Windows \ System32中写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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