|
本帖最后由 wuhenxpe 于 2017-6-25 11:45 编辑
XP 是修改boot.ini , win7、8 要改BCD , 重启加载c:\ img镜像(whnf.sys ),进DOS一键备份
------------------------------------------------------------------------------------------------------------------
@ECHO OFF
rem QQ:271284919 出厂全自动备份系统
title 出厂自动备份系统 V4.0
color 27
MODE con: COLS=80 LINES=34
color 27
echo.
ECHO.
ECHO.
ECHO. ┏━━━━━━━━━━━━━━━━━━━━┓
ECHO. ┃ ┃
ECHO. ┃ 全自动备份系统 V4.0 ┃
ECHO. ┃ ┃
ECHO. ┃ 系统重启将自动备份,请勿断电. ┃
ECHO. ┃ ┃
ECHO. ┗━━━━━━━━━━━━━━━━━━━━┛
ECHO.
:top
echo 程序正在初始化. . .
set a=^set /p=■%b%^<nul^&ping/n 0 127.1^>nul^&
echo ┌────────────────────────────────────┐
set/p= <nul&%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%%a%
echo 100%%
echo └────────────────────────────────────┘
for /d %%a in (.) do set /p b=%%a<nul&ping -n 2 127.1>nu
:md
md d:\ghost >nul 2>nul
attrib +h d:\ghost >nul 2>nul
:OS
for %%b in (c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%b:\ntldr set sd=%%b
if not exist %sd%:\NTLDR goto win7
attrib -r -s -h %sd%:\*.* >nul
if exist %sd%:\boot.in_ del %sd%:\boot.ini >nul
if exist %sd%:\boot.ini ren %sd%:\boot.ini boot.in_ >nul
if exist %sd%:\whldr del %sd%:\whldr >nul
if exist %sd%:\whldr.mbr del %sd%:\whldr.mbr >nul
if exist %sd%:\WHNF.SYS del %sd%:\WHNF.SYS >nul
copy whldr %sd%:\ >nul
copy whldr.mbr %sd%:\ >nul
copy boot.ini %sd%:\ >NUL
copy wHNF.sys %sd%:\ >NUL
shutdown -r -t 00
exit
:win7
for %%b in (c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%b:\boot\bcd set sd=%%b
if not exist %sd%:\boot\bcd goto fail
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
regedit /s admin.reg
REG UNLOAD HKEY_LOCAL_MACHINE\BCD00000000 >nul
copy c:\boot\bcd c:\boot\bcd_ >nul
bcdedit /export "C:\boot\Grub for BCD Backup"
for /f "tokens=1,2,* delims={}" %%i in ('bcdedit /create /d "The first Backup" /application bootsector') do set GrubID=%%j
bcdedit /set {%GrubID%} device boot >nul
bcdedit /set {%GrubID%} path \whldr.mbr >nul
bcdedit /displayorder {%GrubID%} /addlast >nul
bcdedit /default {%GrubID%} >nul
bcdedit /timeout 2 >nul
copy whldr.mbr c:\ /y >NUL
copy whNF.sys c:\ /y >NUL
copy whldr c:\ /y >NUL
shutdown -r -t 00
exit
:FAIL
echo.
ehco. 未能确认系统目录所在盘符,请按任意键退出 !
Pause >nul
EXIT
|
|