Abandon Ghost! Homemade imagex-based system backup batch

  

imagex introduction:
Microsoft's official image packaging tool, based on files, can find the right hardware through files, instead of the sector-based Ghost, The compression ratio is low and there are many problems after the restoration.
The original version of the Vista/Windows 7 installation disk directory under the sources folder install.wim is based on the imagex image.
The measured backup 15G system disk takes 20 minutes (standard compression ratio) and the volume is about 4G.
Reduction takes about 10 minutes.

Because imagex is a command-line operation, many people are big. So I started to use a batch of my three-legged cats to do a simple batch process to achieve a simple system backup /restore. There are many flaws, and I hope that the experts will point out.

Description:
This file can only be run in PE environment (imagex limit)
Windows 7 system is best to do, restart press F8, select "repair computer" Next choice "Command Prompt"
Cut to the directory where bat is located, run abc.bat.

Other systems can also be used, but need CD or USB flash drive to boot to PE mode
One of them is very The big problem is that this drive letter will mess up the D drive does not necessarily become which disk
So many problems are still expected to teach! The following is the code:
@echo off

title System backup program Jiang Zhikun production

echo.

:menu

color ce

mode con:cols=90 lines=18

if exist d:\\imagex\\imagex.exe goto act

echo ============== ==================================================== The program will copy the imagex program to the D drive

echo press any key to continue

echo =======================================================

xcopy %cd%\\imagex d:\\imagex /e /i

goto act

:act

cls

echo ==================================================================== This program needs to run in PE environment

echo Win7 enter PE method:

echo Restart and press F8

echo Select the first item "Repair Computer"

echo Enter after selection "Command Prompt"

echo Auto Backup will default to the system disk as C target disk is D

echo Auto Restore will format the C drive and restore the files under the D drive

echo If data is lost

echo Forbidden cross-province pursuit

echo Welcome to exchange mail:[email protected]

echo ========= ================================ >pause ->nul

goto chose

:chose

cls

echo Please select the operation to be performed and press Enter to confirm

echo 1. Make a backup

echo 2. Restore the system

echo 3. Delete the backup

echo 4. Exit the program

echo 5. Automatic Backup

echo 6. Auto Restore

echo.

set cho=

set /p cho=Input:

if /i "%cho%"=="1" goto 1

if /i "%cho%"=="2" goto 2

if /i "%cho%"== "3" goto 3

if /i "%cho%"=="4" goto 4

if /i "%cho%"=="5" goto 5

if /i "%cho%"=="6" goto 6

cls

echo Select invalid re-enter

pause ->nul

goto chose

:1

cls

set /p xtpanfu=Please enter the partition letter to be backed up:

if not "% Xtpanfu%"=="" set xtpanfu=%xtpanfu:~0,1%

set /p panfu=Please enter the backup file destination drive letter:

if not "%panfu%" =="" set panfu=%panfu:~0,1%

if exist %panfu%:\\systembackup.wim echo will delete the previous backup file &pause&&del %panfu%:\\ Systembackup.wim

d:

cd imagex

im Agex /capture %xtpanfu%: %panfu%:\\systembackup.wim "backup"

echo ========================== ===========

echo Backup is complete! Back up the system in the %panfu% disk

echo file named systembackup.wim

echo Please restart the computer

echo ============ =========================================================================================================== P>goto chose

:2

cls

set /p panfu=Please enter the drive letter of the backup file:

if not "%panfu% "=="" set panfu=%panfu:~0,1%

set /p xtpanfu=Please enter the system letter:

if not "%xtpanfu%"=="" Set xtpanfu=%xtpanfu:~0,1%

echo ================================ =====

echo Determine to format the %xtpanfu% disk

echo and restore it with the image file of %panfu% disk?

echo Enter Y to continue

echo Enter N to return to the menu

echo ====================== ===============

set /p sf=

if /i "%sf%"=="Y" goto Y

if /i "%sf%"=="N" goto chose

cls

Echo input is invalid and will return to the menu

pause

Goto chose

:Y

format %xtpanfu%: /fs:ntfs /q /y

d:

cd imagex

imagex /apply %panfu%:\\systembackup.wim 1 %xtpanfu%:

bcdboot %xtpanfu%:\\Windows /s %xtpanfu%:

echo ======= ============================================================================= Please restart the computer

echo ========================================= P>set /p panfu=

set /p xtpanfu=

set /p sf=

goto chose

:3

cls

set /p panfu=Please enter the drive letter of the backup file:

if not "%panfu%"=="" set panfu=%panfu:~0,1%< Br>

if not exist %panfu%:\\systembackup.wim echo Cannot find the file, press any key to return to the menu &pause ->nul&&cls&&goto chose

del % Panfu%:\\systembackup.wim /f

echo Backup deleted successfully!

goto chose

:4

exit

:5

cls

echo ===== ==================================================================================================== >

echo Press any key to continue

echo ========================================== ==

pause ->nul

d:

cd imagex

imagex /capture c: d:\\systembackup.wim "backup"< Br>

echo =========================================================== Backup is complete! Please restart your computer!

echo ================================================== ->nul

goto chose

:6

cls

echo ================ ====================

echo This operation will format the C drive! Press any key to confirm

echo =================================================

pause ->nul

format c: /q /y

d:

cd imagex

imagex /apply d:\\systembackup .wim 1 c:

bcdboot c:\\Windows /sc:

echo ========================= ============

echo System Restore Complete

echo Please restart the computer

echo =========== ==================================================================== BR>Note: There is imagex.exe in the current directory

Copyright © Windows knowledge All Rights Reserved