实例文件1:
@echo off
set /p input=the drive C backup,press "1" key or recovery,press "2" key:
C盘备份请按“1”键,或C盘恢复请按“2”键
if "%input%"=="1" goto B
if "%input%"=="2" goto R
:B
echo the drive C backup is processing...
C盘正在备份中...
dism /capture-image /imagefile:e:\en_20H2_19042.746.wim /capturedir:c:\ /name:drive-c /Description:10.0.19042.746 /checkintegrity /verify /ScratchDir:e:\Temp
echo the drive C backup completed.
C盘备份已完成。
goto END
:R
if not exist e:\en_20H2_19042.746.wim goto NO
echo format the drive C...
格式化C盘...
diskpart /s E:\bac.txt
echo the drive C recovery is processing...
C盘正在恢复中...
dism /apply-image /imagefile:e:\en_20H2_19042.746.wim /index:1 /applydir:c:\
echo the drive C recovery completed.
C盘恢复已完成。
goto END
:NO
echo the backup file is not existed,please check the file on E!
备份文件不存在,请检查E盘中文件。
:END
echo the mission ended.
会话结束。
实例文件2:
sel disk 0
sel vol 0
format quick label=1064
exit