我知道这个问题已经有了答案,但这还不够。
在Windows中,将用户目录(如“下载”、“文档”)移动到其他目录可以分为三个步骤:
- 修改注册表以指向用户目录的新位置
- (可选)将先前目录中的文件移动到新目录并删除先前目录
- 从以前的目录中删除
desktop.ini
,并desktop.ini
在新目录中创建新目录
我已经设法弄清楚(1)是这样的:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Pictures" /t REG_SZ /d "E:\PICTURE" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Video" /t REG_SZ /d "E:\VIDEO" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal" /t REG_SZ /d "E:\DOCUMENT" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "{374DE290-123F-4565-9164-39C4925E467B}" /t REG_SZ /d "E:\DOWNLOAD" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Pictures" /t REG_EXPAND_SZ /d "E:\PICTURE" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Video" /t REG_EXPAND_SZ /d "E:\VIDEO" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d "E:\DOCUMENT" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "{0DDD015D-B06C-45D5-8C4C-F59713854639}" /t REG_EXPAND_SZ /d "E:\PICTURE" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "{35286A68-3C57-41A1-BBB1-0EAE73D76C95}" /t REG_EXPAND_SZ /d "E:\VIDEO" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "{374DE290-123F-4565-9164-39C4925E467B}" /t REG_EXPAND_SZ /d "E:\DOWNLOAD" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "{7D83EE9B-2244-4E70-B1F5-5393042AF1E4}" /t REG_EXPAND_SZ /d "E:\DOWNLOAD" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "{F42EE2D3-909F-4907-8871-4C22FC0BF756}" /t REG_EXPAND_SZ /d "E:\DOCUMENT" /f
我对 (2) 不感兴趣,所以我继续讨论 (3):
(
echo [.ShellClassInfo]
echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21770
echo IconResource=%%SystemRoot%%\system32\imageres.dll,-112
echo IconFile=%%SystemRoot%%\system32\shell32.dll
echo IconIndex=-235
) > "E:\DOCUMENT\desktop.ini"
attrib +a +s +h "E:\DOCUMENT\desktop.ini"
这将复制“文档”的内容desktop.ini
及其属性。但这段代码有两个问题:
- 文件的编码是UTF-8,但应该是UTF-16 LE BOM。
- 由于
desktop.ini
决定目录的外观,因此包含该目录的目录的本地化名称和图标应视为“文档”。但事实并非如此。
我该如何解决这些问题?