JSI Tip 9615. How do I copy data from a corrupted Windows XP user profile to a new Windows XP user profile?

If you were unable to use tip 4631 » How do I recovery a lost local user profile, possibly due to local hive corruption, and had to create a new Windows XP profile, you might want to copy data from the old profile to the new profile.

I have scripted CpyOldProfile.bat to copy all files, except Ntuser.dat, Ntuser.dat.log, and Ntuser.ini, to your new user profile.

NOTE: See OLEXP: Mail Folders, Address Book, and E-mail Messages Are Missing After You Upgrade to Microsoft Windows XP.

The syntax for using CpyOldProfile.bat is:

CpyOldProfile OldProfileFolder NewProfileFolder

Where OldProfileFolder is the path to your old profile, like "C:\Documents and Settings\Jerry" and NewProfileFolder is the path to your new profile, like "C:\Documents and Settings\Jerold".

NOTE: To run CpyOldProfile.bat, you must have administrative privileges, and NOT be logged on as the new, or old,  user.

NOTE: See How do I recover portions of the registry entries from a previous profile?

CpyOldProfile.bat contains:

@echo off
if \{%2\}==\{\} @echo Syntax: CpyOldProfile OldProfileFolder NewProfileFolder&goto :EOF
if not exist %1 @echo Syntax: CpyOldProfile OldProfileFolder NewProfileFolder - %1 does NOT exist.&goto :EOF
if not exist %2 @echo Syntax: CpyOldProfile OldProfileFolder NewProfileFolder - %2 does NOT exist.&goto :EOF
setlocal
set old=%1
set old=%old:"=%
set new=%2
set new=%new:"=%
for /f "Tokens=*" %%a in ('dir "%old%" /a /b /s^|find /i /v "Ntuser.dat"^|find /i /v "Ntuser.ini"') do (
 call :cpy  "%%a"
)
endlocal
goto :EOF
:pth
set folder=%~DP1
goto :EOF
:cpy
set wrk=%1
set wrk=%wrk:"=%
call set sub=%%wrk:%old%=%new%%%
call :pth "%sub%"
if not exist "%folder%" MD "%folder%"
copy "%wrk%" "%folder%*.*"



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish