Windows – Moving Windows 7 ProgramData folder after installation

windows 7windows-vista

I need to move my C:\ProgramData folder in a Windows 7 installation to D:\ProgramData.

I understand how to make the symlinks and registry changes so this works. My problem is that I'm unable to copy the files in the ProgramData folder because the OS seems to have some of them locked.

Specifically, the files in the C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys folder are blocking the move.

Am I out of luck here? Is there any way to move the folder, create the symlink, and update the registry without any of the files in these folders being locked?

Best Answer

Move the Profile and ProgramData

start from Windows 7 DVD and choose to repair Windows, open Command Prompt (CMD) and type:

move the "Users" folder to the second partition by this command.

  1. ROBOCOPY "C:\Users" "D:\Users" /COPYALL /MIR /XJ.

move the "ProgramData" folder to the second partition by this command.

  1. ROBOCOPY "C:\ProgramData" "D:\ProgramData" /E /COPYALL /MIR /XJ.

delete the "Users" folder from C: partition.

  1. RMDIR "C:\Users" /S /Q

make Junction link to Profile folder in second partition.

  1. MKLINK /J "C:\Users" "D:\Users"

delete C:\ProgramData (ignore any failed massage)

  1. RMDIR "C:\ProgramData" /S /Q

open the Registry Editor and change the profile values to the new path.

  1. REGEDIT.

navigate to this path: HKEY_LOCAL_MACHINE -SOFTWARE -Microsoft -Windows NT -CurrentVersion -ProfileList and change the values to the new path.

after windows restart open CMD as Administrator and delete C:\ProgramData

  1. RMDIR "C:\ProgramData" /S /Q

make Junction link to ProgramData folder in second partition.

  1. MKLINK /J "C:\ProgramData" "D:\ProgramData"
Related Question