没有管理员权限如何删除C:\Program Files\SomeApp?

How do you delete C:\Program Files\SomeApp without administrator privileges?

我目前正在尝试删除我不知道管理员密码的测试 PC 上的 C:\Program Files\SomeApp 文件夹。我可以访问 cmd.exe、powershell,除此之外别无他法。

当我尝试 运行 rm "C:\Program Files\TestApp\*" 我得到这个:

Confirm
The item at C:\Program Files\TestApp has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you
 sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

当我说 y + [ENTER] 时,它是这样说的:

At line:1 char:1
+ rm "C:\Program Files\TestApp\*"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (SomeFile.txt:FileInfo) [Remove-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
rm : Cannot remove item C:\Program Files\TestApp\SomeFile.txt: Access to the path 'SomeFile.txt' is denied.

这是预料之中的,但我希望不是这样。

无论如何,先谢谢了!

启用用户帐户控制(默认和推荐设置),需要管理员权限才能修改C:\Program Files文件夹。

https://docs.microsoft.com/en-us/windows/security/identity-protection/user-account-control/user-account-control-overview

https://docs.microsoft.com/en-us/windows/win32/dxtecharts/user-account-control-for-game-developers

https://docs.microsoft.com/en-us/previous-versions/dotnet/articles/bb530410(v=msdn.10)

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc709691(v=ws.10)