不适用于全部分区是NTFS格式的,只供参考:
@echo off
:: BOOT.INI
attrib c:\boot.ini -s -h -r -a
if not exist c:\boot.ini goto end
for /f "eol=; delims== tokens=1" %%a in ('type c:\boot.ini ^|findstr "multi"') do @set multi=%%a
if %multi%*==* goto end
for /f "tokens=6 delims=()" %%a in ('type c:\boot.ini^|findstr /i "rdisk"') do @set rd=%%a
if "%rd%"=="1" set rdisk=2
if "%rd%"=="0" set rdisk=1
for /f "tokens=8 delims=()" %%a in ('type c:\boot.ini 2^>nul^|findstr /i "partition"') do @set partition=%%a
:: Lastdrive
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for /f %%i in ('wmic logicaldisk where "drivetype=3" get FileSystem ^| find /c "FAT"') do set lastdrive=!drives:~%%i,1!:
if %lastdrive%*==C:* goto end
if %lastdrive%*== :* goto end
:: BACKUP
if not exist %lastdrive%\BACKUP\nul md %lastdrive%\BACKUP
copy Ghost32.exe %lastdrive%\BACKUP /y>nul
copy GhostExp.exe %lastdrive%\BACKUP /y>nul
:: CREATE.TXT
echo -CLONE,MODE=PCREATE,SRC=%rdisk%:%partition%,DST=%lastdrive%\BACKUP\H%rdisk%P%partition%.GHO>%lastdrive%\BACKUP\CREATE.TXT
echo -SKIP=\PAGEFILE.SYS>>%lastdrive%\BACKUP\CREATE.TXT
echo -SURE>>%lastdrive%\BACKUP\CREATE.TXT
echo -RB>>%lastdrive%\BACKUP\CREATE.TXT
:: RESTORE.TXT
echo -CLONE,MODE=PRESTORE,SRC=%lastdrive%\BACKUP\H%rdisk%P%partition%.GHO:1,DST=%rdisk%:%partition%>%lastdrive%\BACKUP\RESTORE.TXT
echo -SURE>>%lastdrive%\BACKUP\RESTORE.TXT
echo -RB>>%lastdrive%\BACKUP\RESTORE.TXT
:end
attrib c:\boot.ini +s +h -a
set multi=
set rd=
set partition=
set drives=
set lastdrive=
Last edited by chishingchan on 2008-1-7 at 08:37 AM ]