---
title: "Win7取得管理员权限 做法"
author: "keren"
date: "2011-12-31T15:50:23Z"
tags: ["window7"]
categories: ["操作系统"]
slug: "win7"
draft: false
lastmod: "2011-12-31T15:50:23Z"
id: 1331968
url: "https://keren.iteye.com/blog/1331968"
---

1, 命名一个文件为 xxx.reg，写入如下内容:

```java

Windows Registry Editor Version 5.00

[hkey_classes_root\*\shell\runas]
@="管理员取得所有权"
"NoWorkingDirectory"=""
[hkey_classes_root\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
[hkey_classes_root\exefile\shell\runas2]
@="管理员取得所有权"
"NoWorkingDirectory"=""
[hkey_classes_root\exefile\shell\runas2\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
[hkey_classes_root\directory\shell\runas]
@="管理员取得所有权"
"NoWorkingDirectory"=""
[hkey_classes_root\directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

```


2, 然后右键某个删除不掉的文件or文件夹，会出现一个，然后就会更改这个文件的权限。

3，点击删除，就可以删除掉那个文件or文件夹了。

![](http://dl.iteye.com/upload/attachment/615009/18ca4722-f0ea-367b-9c03-bf468edcfe49.png)