|
4#
楼主 |
发表于 2012-6-10 18:11:09
|
只看该作者
测试之中,写了一个在PE下备份注册表的.bat。
备份注册表.BAT
- @Echo Off
- if exist BackREG\*.* goto OldFile
- if exist ExptREG\*.* goto OldFile
- md BackREG
- md BackREG\ADM
- md BackREG\ALU
- md BackREG\DFU
- md BackREG\LcS
- md BackREG\NtS
- md BackREG\SFG
- xcopy /H /R "C:\Documents and Settings\Administrator\ntuser.dat" "BackREG\ADM"
- xcopy /H /R "C:\Documents and Settings\All Users\ntuser.dat" "BackREG\ALU"
- xcopy /H /R "C:\Documents and Settings\Default User\ntuser.dat" "BackREG\DFU"
- xcopy /H /R "C:\Documents and Settings\LocalService\ntuser.dat" "BackREG\LcS"
- xcopy /H /R "C:\Documents and Settings\NetworkService\ntuser.dat" "BackREG\NtS"
- xcopy /H /R "C:\WINDOWS\system32\config\DEFAULT" "BackREG\SFG"
- xcopy /H /R "C:\WINDOWS\system32\config\SOFTWARE" "BackREG\SFG"
- xcopy /H /R "C:\WINDOWS\system32\config\SYSTEM" "BackREG\SFG"
- Echo 文件拷贝结束,按任意键 导出注册表!
- pause
- md ExptREG
- reg.exe load HKLM\Reg001 "BackREG\ADM\ntuser.dat"
- reg.exe export HKLM\Reg001 "ExptREG\ADM.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\ALU\ntuser.dat"
- reg.exe export HKLM\Reg001 "ExptREG\ALU.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\DFU\ntuser.dat"
- reg.exe export HKLM\Reg001 "ExptREG\DFU.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\LcS\ntuser.dat"
- reg.exe export HKLM\Reg001 "ExptREG\LcS.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\NtS\ntuser.dat"
- reg.exe export HKLM\Reg001 "ExptREG\NtS.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\SFG\DEFAULT"
- reg.exe export HKLM\Reg001 "ExptREG\sDEFAULT.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\SFG\SOFTWARE"
- reg.exe export HKLM\Reg001 "ExptREG\SOFTWARE.reg"
- reg.exe unload HKLM\Reg001
- reg.exe load HKLM\Reg001 "BackREG\SFG\SYSTEM"
- reg.exe export HKLM\Reg001 "ExptREG\SYSTEM.reg"
- reg.exe unload HKLM\Reg001
- Echo.
- Echo 注册表已 导出成功!
- Echo.
- if exist BackREG2R\*.* goto OldFileB
- ren BackREG BackREG2R
- if exist ExptREG2R\*.* goto OldFileC
- ren ExptREG ExptREG2R
- Echo 注册表已 备份成功!
- Echo 可拷贝到 其它目录!
- Echo.
- Pause
- exit
- :OldFile
- Echo 注册表似乎 已备份两次!
- Echo 或者只备份,并没有导出。
- Echo 如此,它会重头运行一次。
- Echo 当然,旧的备份已经改名。
- Echo.
- ren BackREG BackREG2R
- call %0
- PAUSE
- exit
- :OldFileB
- Echo 已存在旧的 注册表备份!
- PAUSE
- exit
- :OldFileC
- Echo 已存在旧的 导出注册表!
- PAUSE
- exit
复制代码
恢复注册表.BAT
- @Echo Off
- if not exist BackREG2R\*.* goto nofile
- rem if not exist ExptREG2R\*.* goto nofile
- xcopy /H /R /Y "BackREG2R\ADM\ntuser.dat" "C:\Documents and Settings\Administrator"
- xcopy /H /R /Y "BackREG2R\ALU\ntuser.dat" "C:\Documents and Settings\All Users"
- xcopy /H /R /Y "BackREG2R\DFU\ntuser.dat" "C:\Documents and Settings\Default User"
- xcopy /H /R /Y "BackREG2R\LcS\ntuser.dat" "C:\Documents and Settings\LocalService"
- xcopy /H /R /Y "BackREG2R\NtS\ntuser.dat" "C:\Documents and Settings\NetworkService"
- xcopy /H /R /Y "BackREG2R\SFG\DEFAULT" "C:\WINDOWS\system32\config\DEFAULT"
- xcopy /H /R /Y "BackREG2R\SFG\SOFTWARE" "C:\WINDOWS\system32\config\SOFTWARE"
- xcopy /H /R /Y "BackREG2R\SFG\SYSTEM" "C:\WINDOWS\system32\config\SYSTEM"
- :done
- Echo 旧注册表 已经还原!
- PAUSE
- exit
- :nofile
- Echo 文件似乎 没有备份!
- PAUSE
- exit
复制代码
[ 本帖最后由 BestMiniPE 于 2013-1-31 19:20 编辑 ] |
|