简体   繁体   English

Python-删除Windows文件夹

[英]Python - remove Windows folder

I'm messing around in VM Box. 我在VM Box中乱七八糟。 I wanted to delete Windows folder (C:\\Windows). 我想删除Windows文件夹(C:\\ Windows)。 I tryed shutil.rmtree() , os.rmdir() , os.remove() , but still I got access denied. shutil.rmtree()os.rmdir()os.remove() ,但是仍然无法访问。 Is there anyway to do that, like Linux has force remove: rm -rf 'Windows' . 无论如何,有没有这样做,就像Linux强制删除一样: rm -rf 'Windows' Account has Admin Priv. 帐户具有管理员权限。

Active Admin Privs: 活动管理员权限:

first of all, run CMD as Admin and type: 首先,以Admin身份运行CMD并输入:

net user

the table will appear with users. 该表将与用户一起出现。 Next check if real Admin is activated: 接下来检查是否激活了真正的管理员:

net user Administrator

and look for "ACCOUNT ACTIVE". 并寻找“ ACCOUNT ACTIVE”。 If it says 'no', then use this command: 如果显示“否”,请使用以下命令:

net user Administrator /active:yes

and make sure its acttive, so once again type net user Administrator . 并确保其有效,因此再次键入net user Administrator Now switch to that Admin and perform your commands in Python. 现在切换到该管理员,然后在Python中执行命令。

It's interesting experiment, I hope you don't code some malware :D 这是一个有趣的实验,希望您不要编写一些恶意软件:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM