中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 07:33
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » A batch program about backing up and restoring the hard disk master boot sector
Printable Version  1,551 / 1
Floor1 willsort Posted 2004-02-11 00:00
元老会员 Posts 1,512 Credits 4,432
:: 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
Floor2 sgzhou6688 Posted 2010-05-18 14:39
中级用户 Posts 110 Credits 231 From 中国大陆
Download and learn first, thank you very much》》》》》》》》》》》》》》》》》
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023