First and foremost, export the key's original content.
set "ShFlds=HKCU\SOFTWARE\Microsoft\"
set "ShFlds=%ShFlds%Windows\CurrentVersion\"
set "ShFlds=%ShFlds%Explorer\User Shell Folders"
reg export "%ShFlds%" %temp%\CuUShFolders.bkup
Then make the desired changes. For example, to change Internet Explorer's cached files location to D:\Temporary Internet Files —
set "CachFld=D:\Temporary Internet Files"
reg add "%ShFlds%" /V Cache /T REG_EXPAND_SZ /D "%CachFld%" /F
Note that changing the location doesn't move the files. That matters very little for the IE cache, but it may be important for the user's documents, Desktop, or other folders. If this is the case, first save the original location, which is done by the following code.
@echo off
set "ShFlds=HKCU\SOFTWARE\Microsoft\"
set "ShFlds=%ShFlds%Windows\CurrentVersion\"
set "ShFlds=%ShFlds%Explorer\User Shell Folders"
reg query "%ShFlds%" /V "My Music"> %temp%\SaveShF.txt
::Create TAB for delimiter
set "MkTab=%temp%\~tab.js"
echo WScript.Echo("\x09")> %MkTab%
for /f "delims=" %%a in ('cscript //E:JScript //nologo "%MkTab%"') do set "tab=%%a"
del %MkTab%
set "MkTab="
For /f "tokens=1,2* delims=%tab%" %%a in (%temp%\SaveShF.txt) do if NOT "%%c"=="" Set "MyMusic=%%c"
echo Your personal music is stored in --
echo %MyMusic%