前导空格的问题是,每次重新启动时,Dropbox都会在其注册表中添加另一个空格,并且总是比您领先一步。
因此,我计划在这篇文章(由Christoph Zwerschke撰写)中找到一个python脚本,以在每次启动计算机时执行。之后,您还必须重新启动资源管理器。
.bat将如下所示:
python iconOverlayFixer.py
taskkill /f /im explorer.exe
start explorer.exe
和python脚本:
#/usr/bin/python3
import os
import winreg as reg
# names of all overlay icons that shall be boosted:
boost = """
Tortoise1Normal
Tortoise2Modified
Tortoise3Conflict
Tortoise4Locked
Tortoise5ReadOnly
Tortoise6Deleted
Tortoise7Added
Tortoise8Ignored
Tortoise9Unversioned
"""
boost = set(boost.split())
with reg.OpenKey(reg.HKEY_LOCAL_MACHINE,
r'SOFTWARE\Microsoft\Windows\CurrentVersion'
r'\Explorer\ShellIconOverlayIdentifiers') as base:
names = set()
renames = []
i = 0
while True:
try:
name = reg.EnumKey(base, i)
except OSError:
break
core = name.strip()
if core in names:
print('Delete', repr(core))
reg.DeleteKey(base, name)
else:
names.add(core)
if core in boost:
core = ' ' + core
if core != name:
renames.append((name, core))
i += 1
if renames:
for old_name, new_name in renames:
print('Rename', repr(old_name), 'to', repr(new_name))
value = reg.QueryValue(base, old_name)
reg.CreateKey(base, new_name)
reg.SetValue(base, new_name, reg.REG_SZ, value)
reg.DeleteKey(base, old_name)
else:
print('Nothing to rename')