如何在Windows 7或Vista中删除系统文件

Warning: Do not delete system files. Bad things will probably ensue.

警告:请勿删除系统文件。 可能会发生坏事。

If you need to delete or overwrite a system file in Windows 7 or Vista, you’ll quickly notice that you cannot delete system files, even as administrator. This is because Windows system files are owned by the TrustedInstaller service by default, and Windows File Protection will keep them from being overwritten.

如果需要在Windows 7或Vista中删除或覆盖系统文件,您会很快注意到,即使以管理员身份也无法删除系统文件。 这是因为默认情况下Windows系统文件由TrustedInstaller服务拥有,并且Windows文件保护将防止它们被覆盖。

Thankfully, there’s a way that you can get around this. You need to take ownership of the files, and then assign yourself rights to delete or modify the file. For this, we’ll use the command line.

幸运的是,有一种方法可以解决这个问题。 您需要拥有文件的所有权,然后为自己分配删除或修改文件的权限。 为此,我们将使用命令行。

Open an administrator command prompt by typing cmd into the start menu search box, and hit the Ctrl+Shift+Enter key combination.

在开始菜单搜索框中键入cmd,打开管理员命令提示符,然后按Ctrl + Shift + Enter组合键。

To take ownership of the file, you’ll need to use the takeown command. Here’s an example:

要获得文件的所有权,您需要使用takeown命令。 这是一个例子:

takeown /f C:\Windows\System32\en-US\winload.exe.mui

带上/ f C:\ Windows \ System32 \ en-US \ winload.exe.mui

That will give you ownership of the file, but you still have no rights to delete it. Now you can run the cacls command to give yourself full control rights to the file:

这将使您拥有该文件的所有权,但是您仍然无权删除它。 现在,您可以运行cacls命令来为自己赋予对该文件的完全控制权限:

cacls C:\Windows\System32\en-US\winload.exe.mui /G geek:F

cacls C:\ Windows \ System32 \ en-US \ winload.exe.mui / G geek:F

Note that my username is geek, so you will substitute your username there.

请注意,我的用户名是geek,因此您将在此处替换用户名。

At this point, you should be able to delete the file. If you still can’t do so, you may need to reboot into Safe Mode and try it again. For the filename in the example, I was able to overwrite it without safe mode, but your mileage may vary.

此时,您应该可以删除该文件。 如果仍然无法执行此操作,则可能需要重新启动进入安全模式,然后重试。 对于示例中的文件名,我可以在没有安全模式的情况下将其覆盖,但是您的里程可能会有所不同。

翻译自: https://www.howtogeek.com/howto/windows-vista/how-to-delete-a-system-file-in-windows-vista/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值