China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 08:20
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » A batch program about backing up and restoring the hard disk master boot sector View 1,554 Replies 1
Original Poster Posted 2004-02-11 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
:: 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
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 2 Posted 2010-05-18 14:39 ·  中国 山东 联通
中级用户
★★
Credits 231
Posts 110
Joined 2008-03-24 16:22
18-year member
UID 113876
Gender Male
From 中国大陆
Status Offline
Download and learn first, thank you very much》》》》》》》》》》》》》》》》》
Forum Jump: