更新 win10 的四月更新后,视频、图片、文档、下载、音乐、桌面、3D 对象七个文件夹又拱了出来,选取文件时有点影响,于是翻出之前写的一个隐藏这些文件夹的 python 脚本,想着也许有人需要,于是分享出来。没什么技术含量,代替人工操作注册表而已,python3 的。觉得有用的可以看心情给个Star
import winreg
Explorer = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer')
key = winreg.OpenKey(Explorer, r'FolderDescriptions')
names = (
'{0ddd015d-b06c-45d5-8c4c-f59713854639}', # 图片
'{35286a68-3c57-41a1-bbb1-0eae73d76c95}', # 视频
'{7d83ee9b-2244-4e70-b1f5-5393042af1e4}', # 下载
'{a0c69a99-21c8-4671-8703-7934162fcf1d}', # 音乐
'{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}', # 桌面
'{f42ee2d3-909f-4907-8871-4c22fc0bf756}', # 文档
)
for name in names:
child = winreg.OpenKey(key, name + r'\PropertyBag', 0, winreg.KEY_ALL_ACCESS)
winreg.SetValueEx(child, "ThisPCPolicy", 0, 1, "Hide")
# 3D 对象
NameSpace = winreg.OpenKey(Explorer, r'MyComputer\NameSpace')
winreg.DeleteKey(NameSpace, '{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}')
1
devtiange 2018-05-02 13:11:59 +08:00
感谢分享! 不过这种事情, 用 powershell 会更好一点吧.
|
2
yulitian888 2018-05-02 13:16:16 +08:00
写一个注册表文件不是更简单?
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag] "ThisPCPolicy"="Hide" |
3
jy02534655 2018-05-02 13:47:05 +08:00 3
ThisPCTweaker 了解下
|
4
yjd 2018-05-02 13:52:53 +08:00 1
普通用户还得有 py 环境。俺存的
--------------------------------------- Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag] "ThisPCPolicy"="Hide" [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag] "ThisPCPolicy"="Hide" -----------------------------恢复 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag] "ThisPCPolicy"=- [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag] "ThisPCPolicy"=- |
5
neighbads 2018-05-02 15:44:20 +08:00
不错哦。。。不知道有没有权限问题。
|
7
YTS 2018-05-02 18:35:30 +08:00 via iPhone
有个问题,怎么找回来呢😂3D 对象
|
8
kamen 2018-05-02 18:45:31 +08:00 1
|
9
kamen 2018-05-02 18:47:11 +08:00
@kamen #8 如果你发现了新的自定义 windows 的规则,建议提交给 dism++团队,他们的轮子造的非常好,也有非常多的人在用
|
10
KeySouundsFan 2018-05-02 18:51:36 +08:00
又不是直接影响生产力,还是尝试养成新的习惯吧,再过个三五年 win10 全面普及,到别人机器上操作的时候你就尝到苦头了
|
11
lqzhgood 2018-05-04 18:21:02 +08:00
@yjd 用 “ HIDE ” 有个副作用, [个人文件夹] 里面的 文档神马的也会被隐藏。。。但是从 C:\Users\xx 里面进去还会看得到
|
12
scruel 2018-05-05 13:24:38 +08:00
|