『第
17 楼』:
之前还未完善的作品:或许大家看过后会明白
install.cmd
@echo off
:: 获取硬盘最后分区盘符
for %%a 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 (for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr /i "固定驱动器"') do set cmdlastdrive=%%h)
:: 如果最后分区是系统分区,退出
if %cmdlastdrive%*==%SystemDrive%* mshta vbscript:msgbox("备份分区不能用于安装系统!",0,"错误")(window.close)&&exit
:: 获取硬盘最后分区格式
for /f "tokens=2 delims=: " %%a in ('fsutil fsinfo volumeinfo %cmdlastdrive%\^|find "文件系统名"') do set cldformat=%%a
:: 如果分区不是FAT32格式,退出
if not %cldformat%*==FAT32* mshta vbscript:msgbox("备份分区只能使用FAT32格式!",0,"错误")(window.close)&&exit
:: 如果备份分区容量少于1GB,退出
for /f "tokens=2" %%a in ('chkdsk %cmdlastdrive%^|find "总"') do set size=%%a
if %size:,=% lss 1024000 mshta vbscript:msgbox("备份分区容量不能少于 1GB!",0,"错误")(window.close)&&exit
:: 建立备份恢复目录
if not exist %cmdlastdrive%\BACKUP\nul md %cmdlastdrive%\BACKUP
:: 获取系统分区标识
for /f "tokens=6 delims=()" %%a in ('type c:\boot.ini^|findstr /i "rdisk"') do @set rd=%%a
set /a rd+=1
for /f "tokens=8 delims=()" %%a in ('type c:\boot.ini 2^>nul^|findstr /i "partition"') do @set partition=%%a
:: 获取纯DOS方式的最后盘符
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for /f %%i in ('wmic logicaldisk where "drivetype=3" get FileSystem ^| find /c "FAT"') do set doslastdrive=!drives:~%%i,1!:
:: 设置备份文件:CREATE.TXT
>%cmdlastdrive%\BACKUP\CREATE.TXT echo -CLONE,MODE=PCREATE,SRC=%rd%:%partition%,DST=%doslastdrive%\BACKUP\H%rd%P%partition%.GHO
>>%cmdlastdrive%\BACKUP\CREATE.TXT echo -SKIP=\PAGEFILE.SYS
>>%cmdlastdrive%\BACKUP\CREATE.TXT echo -Z9
>>%cmdlastdrive%\BACKUP\CREATE.TXT echo -SURE
>>%cmdlastdrive%\BACKUP\CREATE.TXT echo -RB
:: 设置恢复文件:RESTORE.TXT
>%cmdlastdrive%\BACKUP\RESTORE.TXT echo -CLONE,MODE=PRESTORE,SRC=%doslastdrive%\BACKUP\H%rd%P%partition%.GHO:1,DST=%rd%:%partition%
>>%cmdlastdrive%\BACKUP\RESTORE.TXT echo -SURE
>>%cmdlastdrive%\BACKUP\RESTORE.TXT echo -RB
vfloppy.exe -1 c:\vloader.bin -2 c:\vmemdsk.bin -i c:\vfloppy.ima
:: 设置分区卷标名称
if not %SystemDrive%*==C:* label C: 启动
label %SystemDrive% 系统
label %cmdlastdrive% 备份 install.inf
[Version]
Signature="$CHICAGO$"
[DefaultInstall]
CopyFiles = VirtualFloppy.CopyFiles
UpdateInis = boot.ini
[DestinationDirs]
VirtualFloppy.CopyFiles = 30
[VirtualFloppy.CopyFiles]
vfloppy.ima
vloader.bin
vmemdsk.bin
[boot.ini]
%30%\boot.ini,"operating systems",,"%30%\vloader.bin=""虚拟软盘:自动备份或恢复系统数据。 """ [ Last edited by chishingchan on 2008-11-26 at 22:31 ]
|