|
@echo off
mode con cols=90 lines=26
:: 批处理获取管理员权限
:-------------------------
%1 mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&&exit /b
pushd "%CD%"
CD /D "%~dp0"
:-------------------------
for %%a in (C D E F G H I J K L M ) do (
SET SNADIR=%%a:\SNAP\
IF exist %%a:\SNAP\ GOTO MENU
IF exist %%a: SET n1=%%a
)
SET DIRS=%n1%
SET /P DIRS= 请输入备份存放工作盘C--%DIRS%盘符 回车:
SET SNADIR=%DIRS%:\SNAP\
MD %SNADIR%
GOTO MENU
EXIT
:MENU
CLS
title SNAPSHOT 系统备份恢复
for /l %%i in (1,1,10) do (
set /a n=%%i+1
IF NOT EXIST %SNADIR%SYSC%%i.sna GOTO PASS
)
:PASS
SET /A Bn=n-1
SET /A Hn=n-2
color 1f
echo.
echo. 备份目录%SNADIR%中存在的SNA映像文件
echo.==============================
dir %SNADIR%*.sna /b
echo.==============================
echo. SNAPSHOT 备份恢复系统
echo. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
echo. [5] 一键自动备份系统
echo.
echo. [0] 一键自动恢复系统
echo.
echo. [2] 查看备份%SNADIR%目录
echo.
echo. [1] 手动选择备份恢复系统
echo.
echo. [E] 退出
echo. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
set ST1=2
SET /P ST1= 请输入选项(默认:%ST1%)回车:
if /I "%ST1%"=="5" goto winbackup
if /I "%ST1%"=="0" goto winrecover
if /I "%ST1%"=="2" goto folderopen
if /I "%ST1%"=="1" goto SHOU
if /I "%ST1%"=="e" goto exit
exit
:SHOU
SNAPSHOT64.EXE -L0
GOTO MENU
EXIT
:winbackup
IF NOT EXIST %SNADIR%SYSC0.SNA GOTO BACKUP1
SET ST9=%Bn%
SET /P ST9= 按E键--返回主菜单 默认备份SYSC%ST9%.SNA文件 回车:
if /I "%ST9%"=="e" goto MENU
"Snapshot64.exe" C: %SNADIR%SYSC%ST9%.sna -R -Gx -L0 -H%SNADIR%SYSC0.HSH
PAUSE
GOTO MENU
exit
:BACKUP1
SET ST0=0
SET /P ST0= 按E键--返回主菜单 默认备份SYSC0.SNA文件 回车:
if /I "%ST0%"=="e" goto MENU
"Snapshot64.exe" C: %SNADIR%SYSC0.SNA -R -Gx -L0
pause
GOTO MENU
EXIT
:winrecover
IF NOT EXIST %SNADIR%SYSC0.SNA GOTO MENU
IF EXIST "X:\WINDOWS\" GOTO PEWIN
SET ST3=%Hn%
SET /P ST3= 按E键--返回主菜单 默认恢复SYSC%ST3%.SNA文件 回车:
if /I "%ST3%"=="e" goto MENU
snapshot64 --schedule c: %SNADIR%SYSC%ST3%.sna --autoreboot:any
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Snapshot" /f /v "AutoReboot" /t REG_DWORD /d 1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Snapshot" /f /v "AutoRebootSuccess" /t REG_DWORD /d 0
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Snapshot" /f /v "Timeout" /t REG_DWORD /d 3
shutdown -r -t 0
GOTO MENU
EXIT
:PEWIN
IF NOT EXIST %SNADIR%SYSC0.SNA GOTO MENU
set ST4=%Hn%
SET /P ST4= 按E键--返回主菜单 默认恢复SYSC%ST4%.SNA文件 回车:
if /I "%ST4%"=="e" goto MENU
snapshot64 %SNADIR%SYSC%ST4%.sna c: -Y -Gx
shutdown -r -t 0
GOTO MENU
EXIT
:folderopen
DIR %SNADIR%
pause
GOTO MENU
exit
|
|