Script for Ghost Imaging

 

----------------------begin---------------------

@ECHO OFF

if %1x==x goto syntax

if %2x==x goto menu

if %3x==x goto menu

if %1==dump goto set0

if %1==pdump goto set0

 

:syntax

echo Syntax: Disk2Img FileName

echo or    : Disk2Img dump d FileName

echo or    : Disk2Img pdump d:p FileName

echo.

echo Where : dump = Copy entire disk d to image file

echo         pdump = Copy Partition p from disk d to image file

echo         d = disk number. First physical hard disk is number 1

echo         p = partition number. First partition is number 1

echo         FileName = file to write image.

echo Note: Do not put an extension on the FileName.

echo       The extension .GHO will be appended.

echo.

echo Eg: Disk2Img pdump 1:1 Myfile

echo     will create the image file Myfile.gho from the first partition

echo     on the first disk.

echo.

echo Eg: Disk2Img pdump 1:2 Cpqimg

echo     will create the image file Cpqimg.gho from the second partition

echo     on the first disk. (Use this to skip the Compaq system partition)

echo.

echo Eg: Disk2Img dump 1 diskimg

echo     will create the image file diskimg.gho containing all partitions

echo     on the first disk.

goto end

 

:set0

SET PD=%1

SET SRC=%2

SET FN=%3.GHO

GOTO chkit

 

:menu

echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿

echo ³             Image File Creation Menu                ³

echo ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

echo ³                                                     ³

echo ³  1. Dump the first partition on first disk (1:1)    ³

echo ³                                                     ³

echo ³  2. Dump the second partition on first disk (1:2)   ³

echo ³                                                     ³

echo ³  3. Dump the entire first disk (1)                  ³

echo ³                                                     ³

echo ³  X. Exit                                            ³

echo ³                                                     ³

echo ³  Note: For other combinations of disk or partition  ³

echo ³        use the following syntax:                    ³

echo ³                                                     ³

echo ³        Disk2Img dump d FileName                     ³

echo ³  or                                                 ³

echo ³        Disk2Img pdump d:p FileName                  ³

echo ³                                                     ³

echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

choice /N /C:123X " ==> "

if errorlevel 4 goto end

if errorlevel 3 goto set3

if errorlevel 2 goto set2

 

:set1

SET PD=pdump

SET SRC=1:1

SET FN=%1.GHO

GOTO chkit

 

:set2

SET PD=pdump

SET SRC=1:2

SET FN=%1.GHO

GOTO chkit

 

:set3

SET PD=dump

SET SRC=1

SET FN=%1.GHO

GOTO chkit

 

:chkit

if not exist %FN% goto doit

echo.

echo The file %FN% already exists.

choice /N /C:YN "Do you want to overwrite [Y/N] ? "

if errorlevel 2 goto end

 

:doit

ghost -clone,mode=%PD%,src=%SRC%,dst=%FN% -z1 -ntil -fx -fnf -batch -sure

 

:end

--------------end---------------------