Guides abound on the Internet about how to use Robocopy to save the files in a User's profile directory in Windows 7 (Vista, 8, etc.), using the command:
robocopy [USER] [BACKUP] /MIR /XJ
These guides always make sure to mention to use the /XJ flag to ensure to ignore the special Junctions (/Application Data, /Start Menu, etc.) that Microsoft created in Vista for backward compatibility with XP.
But, when the time comes to restore the backup I made, how do I do that?
If I login with the user once to create a folder in the Users directory, log out, and then try to use Robocopy to copy to that directory (robocopy [BACKUP] [USER] /MIR /XJ), Robocopy seems to ignore the /XJ switch and parses the Junctions, and enters a circular loop with the /Local Settings/Application Data/Application Data/... path.
If I do a login/logoff with the user, and then delete the user's folder, and use Robocopy to recreate it (robocopy [BACKUP] [USER] /MIR), Windows will use that user's folder for the user, but not create the backward-compatibility Junctions.
If I try to make the copy before the user's first login, it will create the folder, but Windows won't use it for the user's profile folder, but will instead create a folder with a different name for the user's profile folder.
Am I missing a flag, or can I issue a command to Windows to force it to recreate its special Junctions?