Win11终端获取 Trustedinstaller 权限删除文件夹

1,151 阅读1分钟

Step1 获取Trustedinstaller权限

Win10 / Win11 如何真正获取 Trustedinstaller 权限(非修改所有者及权限) - IT之家 (ithome.com)

不同之处

稍等片刻,等待安装结束。结束后,我们需要让系统允许使用 Powershell 脚本,我们输入:Set-ExecutionPolicy Unrestricted 并回车。接着系统会显示执行策略更改,我们输入”A“并回车确认:

这里我操作时系统并未显示执行策略更改

现在,我们开始正式获得 Trustedinstaller 权限。在 Powershell 中依次输入:

sc.exe start TrustedInstallerSet-NtTokenPrivilege SeDebugPrivilege
$p = Get-NtProcess -Name TrustedInstaller.exe
$proc = New-Win32Process cmd.exe -CreationFlags NewConsole -ParentProcess $p

并回车。

我在执行第一条语句时,出现 [SC] StartService: OpenService 失败 1060:

上网查询类似问题 (1 封私信 / 80 条消息) 请问关于sc openservice 失败1060该怎么办? - 知乎 (zhihu.com)

决定继续执行第二条和第三条语句

接下来按照教程继续操作,成功获取Trustedinstaller权限

Step2 切换终端当前目录

怎么在cmd中进入D盘下的文件夹_cmd 进入d盘_喜剧新人的博客-CSDN博客

切换盘符和切换在同一盘符中切换目录不一样

从cmd中进入D盘,在光标处输入“d:”(大小写都可以),按enter进入。

Step3 删除文件夹

如何在 Windows 中使用 cmd 删除文件和文件夹 (freecodecamp.org)
使用rmdir /s <directory name>删除目录,包括所有嵌套的文件和子目录