0

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:

  1. Modify registry to point new location of user's directory
  2. (Optional) Move files in previous directory to new directory and delete previous directory
  3. Remove desktop.ini from previous directory, and create new desktop.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:

  1. File's encoding is UTF-8, but it should be UTF-16 LE BOM.
  2. 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?

4
  • The old folder should have desktop.ini. Why don't you just move it over? eg: attrib desktop.ini +a -s -h desktop.ini move desktop.ini c:\new\location cd c:\new\location attrib desktop.ini +a +s +h
    – LPChip
    Commented May 21 at 9:00
  • I copied desktop.ini from 'Documents' to other directory for testing. The new directory doesn't look as 'Documents'. Restarting explorer.exe doesn't help with this.
    – tetratheta
    Commented May 21 at 14:25
  • You need to attrib the desktop.ini but also the folder itself.
    – LPChip
    Commented May 21 at 15:32
  • You're right. After assigning 'Read' attribute to folder, it look like 'Document' folder! Thanks a lot!
    – tetratheta
    Commented May 21 at 17:52

1 Answer 1

2

In order to fix it, make sure you copy the desktop.ini from the source to the destination, and ensure that you change the file attributes of desktop.ini to give it alteast +s +h.

Then change the attribute of the folder and give it at least +r.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .