I know that there is already an answer for this, but that isn't sufficient.
In Windows, moving user's directory like 'Download', 'Documents' to other directories can be splitted into three steps:
- Modify registry to point new location of user's directory
- (Optional) Move files in previous directory to new directory and delete previous directory
- Remove
desktop.ini
from previous directory, and create newdesktop.ini
to new directory
I've managed to figure out (1) like this:
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
I'm not interested in (2), so I moved on to (3) with this:
(
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"
This will replicate the content of desktop.ini
for 'Documents', and its attributes. But this code has two problem:
- File's encoding is UTF-8, but it should be UTF-16 LE BOM.
- Since
desktop.ini
decides appearance of directory, the directory containing it should be look as 'Documents' for its localized name and icon. But it doesn't.
How can I solve these issues?
attrib desktop.ini +a -s -h desktop.ini
move desktop.ini c:\new\location
cd c:\new\location
attrib desktop.ini +a +s +h
desktop.ini
from 'Documents' to other directory for testing. The new directory doesn't look as 'Documents'. Restartingexplorer.exe
doesn't help with this.