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

Jerold Schulman

August 1, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 SettingsJerry" and NewProfileFolder is the path to your new profile, like "C:Documents and SettingsJerold".

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 offif {%2}=={} @echo Syntax: CpyOldProfile OldProfileFolder NewProfileFolder&goto :EOFif not exist %1 @echo Syntax: CpyOldProfile OldProfileFolder NewProfileFolder - %1 does NOT exist.&goto :EOFif not exist %2 @echo Syntax: CpyOldProfile OldProfileFolder NewProfileFolder - %2 does NOT exist.&goto :EOFsetlocalset old=%1set old=%old:"=%set new=%2set 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")endlocalgoto :EOF:pthset folder=%~DP1goto :EOF:cpyset wrk=%1set wrk=%wrk:"=%call set sub=%%wrk:%old%=%new%%%call :pth "%sub%"if not exist "%folder%" MD "%folder%"copy "%wrk%" "%folder%*.*"



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like