Backup encountered a problem while backing up file C:\Users\ddaydj\Documents. Error:(The system cannot find the path specified. (0x80070003))I was ignoring it for a while, but got tired of my backups having errors. After looking around my computer and doing some research, I realized my junctions that were created with the user profile, were still pointing at my old user folder (I did an article about junctions a while back). So I went ahead and made a script to go through and delete all the default junctions in my user folder and recreate them.
Below is the script I wrote. You can copy and paste it into notepad and save it as a .cmd file. It requires that you run it as an administrator, so if your user account is not an admin change the 3rd line where it says %USERPROFILE% to the path to your user folder (Example: C:\Users\ddaydj).
Edit: Well, I just learned a lot more about doing batch files. Below is an updated version of the script that should be significantly nicer to look at and easier to understand (not to mention 71% smaller). Also, if you want your My Games folder to redirect to Saved Games, remove the REM from line 17.
@ECHO OFFEdit #2: Turns out this wasn't what was causing my problems Windows Backup. My registry modifications to migrate my profile were incomplete and I also needed to change all the entries here to point to the new folder, HKU\SID\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders. The script is still helpful for cleaning up junctions though.
CALL :MKJUNCTION "\Application Data" "\AppData\Roaming"
CALL :MKJUNCTION "\Cookies" "\AppData\Roaming\Microsoft\Windows\Cookies"
CALL :MKJUNCTION "\Local Settings" "\AppData\Local"
CALL :MKJUNCTION "\My Documents" "\Documents"
CALL :MKJUNCTION "\NetHood" "\AppData\Roaming\Microsoft\Windows\Network Shortcuts"
CALL :MKJUNCTION "\PrintHood" "\AppData\Roaming\Microsoft\Windows\Printer Shortcuts"
CALL :MKJUNCTION "\Recent" "\AppData\Roaming\Microsoft\Windows\Recent"
CALL :MKJUNCTION "\SendTo" "\AppData\Roaming\Microsoft\Windows\SendTo"
CALL :MKJUNCTION "\Start Menu" "\AppData\Roaming\Microsoft\Windows\Start Menu"
CALL :MKJUNCTION "\Templates" "\AppData\Roaming\Microsoft\Windows\Templates"
CALL :MKJUNCTION "\AppData\Local\Application Data" "\AppData\Local"
CALL :MKJUNCTION "\AppData\Local\History" "\AppData\Local\Microsoft\Windows\History"
CALL :MKJUNCTION "\AppData\Local\Temporary Internet Files" "\AppData\Local\Microsoft\Windows\Temporary Internet Files"
REM CALL :MKJUNCTION "\Documents\My Games" "\Saved Games"
CALL :MKJUNCTION "\Documents\My Music" "\Music"
CALL :MKJUNCTION "\Documents\My Pictures" "\Pictures"
CALL :MKJUNCTION "\Documents\My Videos" "\Videos"
MKLINK /J "%MYUSERPROFILE%%~1" "%MYUSERPROFILE%%~2"
ATTRIB +S +H +I "%MYUSERPROFILE%%~1" /L
ICACLS "%MYUSERPROFILE%%~1" /deny *S-1-1-0:(RD)