:: MBRMAN.BAT - First version - 2004/02/10
:: A batch program for backing up and restoring the hard disk master boot record
::
:: Declaration:
:: This program code has important read and write operations on the hard disk, and it has not been tested; beginners should not try it easily!
@echo off
if == goto guide
for %%a in (b B backup BACKUP) do if == set op=02
for %%a in (r R restore RESTORE) do if == set op=03
:guide
:
rint a simple description and precautions about MBR here
cls
echo.
echo.
echo Please select the operation you want to perform:
echo Press B to back up the master boot sector;
echo Press R to restore the master boot sector;
echo Press Q to exit here;
choice /c:brq /n > nul
if errorlevel 3 goto end
if errorlevel 2 set op=03
if errorlevel 1 set op=02
if == goto end
perate
echo.>operate.asd
if == echo L >>operate.asd
echo a 300 >>operate.asd
echo mov ax,%op%01 >>operate.asd
echo mov bx,0100 >>operate.asd
echo mov cx,0001 >>operate.asd
echo mov dx,0080 >>operate.asd
echo int21 >>operate.asd
echo int20 >>operate.asd
echo. >>operate.asd
echo g >>operate.asd
if == echo r cx >>operate.asd
if == echo 200 >>operate.asd
if == echo w >>operate.asd
echo q>>operate.asd
echo Confirm to perform this operation:
echo Press Y to confirm;
echo Press N otherwise;
choice /n > nul
if errorlevel 2 goto end
debug hdmbr.dat nul
echo Operation successful!
:end
:: A batch program for backing up and restoring the hard disk master boot record
::
:: Declaration:
:: This program code has important read and write operations on the hard disk, and it has not been tested; beginners should not try it easily!
@echo off
if == goto guide
for %%a in (b B backup BACKUP) do if == set op=02
for %%a in (r R restore RESTORE) do if == set op=03
:guide
:
rint a simple description and precautions about MBR herecls
echo.
echo.
echo Please select the operation you want to perform:
echo Press B to back up the master boot sector;
echo Press R to restore the master boot sector;
echo Press Q to exit here;
choice /c:brq /n > nul
if errorlevel 3 goto end
if errorlevel 2 set op=03
if errorlevel 1 set op=02
if == goto end
perateecho.>operate.asd
if == echo L >>operate.asd
echo a 300 >>operate.asd
echo mov ax,%op%01 >>operate.asd
echo mov bx,0100 >>operate.asd
echo mov cx,0001 >>operate.asd
echo mov dx,0080 >>operate.asd
echo int21 >>operate.asd
echo int20 >>operate.asd
echo. >>operate.asd
echo g >>operate.asd
if == echo r cx >>operate.asd
if == echo 200 >>operate.asd
if == echo w >>operate.asd
echo q>>operate.asd
echo Confirm to perform this operation:
echo Press Y to confirm;
echo Press N otherwise;
choice /n > nul
if errorlevel 2 goto end
debug hdmbr.dat nul
echo Operation successful!
:end
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
