在Windows 7中将用户配置文件复制到默认配置文件

时间:2012-08-15 13:38:48

标签: windows windows-7 batch-file profile robocopy

我正试图找到一种方法,希望使用批处理文件将修改后的用户配置文件复制到默认用户配置文件,以便登录到计算机的任何用户都将采用配置文件设置。我们使用名为pGina的实用程序来调用通过RADIUS服务器登录的用户的默认配置文件,而不是让用户直接登录到域。目前,我们正在尝试使用robocopy。

cd C:\Users\
rmdir Default /s /q
robocopy /COPY:DAT /R:5 /E C:\Users\user1 C:\Users\Default
pause

有谁知道如何成功复制个人资料?提前谢谢。

1 个答案:

答案 0 :(得分:1)

这是我在搜索问题答案时found

rem delete old Default User profile
RD /s /q "%systemdrive%\Profiles\Default User"

rem copy current user profile to default user profile
xcopy "%USERPROFILE%\*.*" "%systemdrive%\Profiles\Default User" /e /c /I /H /R /K /Y 
rem delete non-need some files 
del /f /q "%systemdrive%\Profiles\Default User\*.*" 
rem set default attributes
attrib +h "%systemdrive%\Profiles\Default User"

rem registry trick
rem no directly copy locked ntuser.dat file
rem use reg tools to save current user registry to file
reg save HKCU "%systemdrive%\Profiles\Default User\ntuser.dat"
rem set default attributes to hive file  
attrib +H +S "%systemdrive%\Profiles\Default User\ntuser.dat"
相关问题