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-02 10:21
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to write a batch script for one-click restoration? View 1,988 Replies 14
Original Poster Posted 2006-10-19 23:24 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
ghost.exe -clone,mode=pload,src=H:\sys\xp.GHO,dst=1:1 -sure -rb
This is to automatically restore the H drive to the C drive. How to add a menu item named "One - Click Restore" at boot time so that pressing it can execute the above statement to achieve automatic restoration... All partitions are in FAT32 format... Do you need to install a pure DOS..... How to achieve it...

Can someone give a code~~~
Floor 2 Posted 2006-10-19 23:46 ·  中国 江苏 苏州 电信
银牌会员
★★★
Credits 1,181
Posts 533
Joined 2006-08-14 12:54
19-year member
UID 60484
Status Offline
There are many people here who have done similar things. You can find a few to download and take a look first?
Floor 3 Posted 2006-10-20 04:26 ·  中国 河南 洛阳 电信
银牌会员
★★★
Credits 1,455
Posts 712
Joined 2006-01-20 10:26
20-year member
UID 49246
Status Offline
Originally posted by zerostudy at 2006-10-19 23:24:
ghost.exe -clone,mode=pload,src=H:\sys\xp.GHO,dst=1:1 -sure -rb
This is to automatically restore the H drive to the C drive. May I ask how to add a menu named..One-click Restore.. at startup, and by pressing it, it can execute the above...

Hehe, it's not a good habit to handle problems rashly. The command ghost of the building owner cannot be executed!
The correct writing is: ghost.exe -clone,mode=pload,src=H:\sys\xp.GHO:1,dst=1:1 -sure -rb
You need to install a DOS system to your hard drive, and specify to call your "restore" batch file in Autoexec.bat. In this way, when booting into dos, you can execute the restore command.
As for the menu at startup, as long as you install dos to the hard drive, there will usually be a new menu added. You can change the menu name at will in boot.ini.
Floor 4 Posted 2006-10-20 06:23 ·  中国 江西 鹰潭 电信
中级用户
★★
Credits 244
Posts 92
Joined 2006-05-13 21:24
20-year member
UID 55477
Status Offline
First, use Vfloppy to create a virtual boot. Of course, other methods can also be used.

Then download winimage.
Use winimage to modify the bootdisk.img in Vfloppy.
Export the config.sys file and the autoexec.bat file.

Content of config.sys:
DOS=HIGH,UMB,AUTO

Content of autoexec.bat:
ghost -clone,mode=pload,src=h:\sys\xp.gho:1,dst=1:1 -sure -rb

Then import the modified config.sys and autoexec.bat into bootdisk.img using winimage.
Then use the Vfloppy image file.

Then you can change "Boot from virtual boot floppy" to "System Restore".
Then apply and restart to the option selection screen, select "System Restore", and it will automatically restore.
Floor 5 Posted 2006-10-20 11:58 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
The two files in Vfloppy have too much content... What are they for? I can't understand... Should I delete all of them..

Content of config.sys
DOS=HIGH,UMB,AUTO

Content of autoexec.bat
ghost -clone,mode=pload,src=h:\sys\xp.gho:1,dst=1:1 -sure -rb
..Just add these....
Now I don't restart yet, I'm downloading something.. I'll try later....
Floor 6 Posted 2006-10-21 02:39 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 7 Posted 2006-10-21 03:17 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
Excuse me, moderator.. That ghost file is too large and can't be added in.... Can you send me a large img empty image?.... Can config.sys specify to execute ghost.exe in an external folder?? Is there a simple introduction tutorial for config.sys and autoext.bat?
Floor 8 Posted 2006-10-21 03:39 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
The content of autoexec.bat

Add an IF statement to make it necessary to enter a password to execute the following ghost.

How to write this if... I looked it up. I don't know what to use to define variables. And what to use to represent keyboard input.....

ghost -clone,mode=pload,src=h:\sys\xp.gho:1,dst=1:1 -sure -rb
Floor 9 Posted 2006-10-21 04:17 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
config.sys
DEVICE=HIMEM.sys
DOS=HIGH,UMB,AUTO

autoexec.bat
How to add this???
smartdrv.exe
c:
cd dosghost
ghost -clone,mode=pload,src=h:\sys\xp.gho:1,dst=1:1 -sure -rb

p su That works... May I ask how to encrypt here in autoexec.bat? You need to enter a password to proceed???
Floor 10 Posted 2006-10-21 20:48 ·  中国 广东 佛山 广东睿江科技有限公司
初级用户
Credits 74
Posts 30
Joined 2006-06-01 17:04
20-year member
UID 56385
Status Offline
Originally posted by zerostudy at 2006-10-21 03:17:
Excuse me, moderator.. That ghost file is too large to add... Can you send me a large img empty image?
....Can config.sys execute ghost.exe in an external folder??
Is there any simple...



1. config.sys cannot run ghost.exe; you need to add it in autoexec.bat;
2. The ghost.exe is too large, you can copy it to the hard drive and call it with the path.

I have one I made myself, you can try it. For the restart item in item 4, you can find a DOS restart command yourself.

*******************************************************

@ECHO OFF
TH
ECHO Operating System One - Click Restore
ECHO Please use the number key to select the menu
ECHO.
ECHO 1. Automatically Backup C: Drive
ECHO 2. Automatically Restore C: Drive
ECHO 3. Boot to MS-DOS
ECHO 4. Restart System
ECHO.
ECHO Note: Please back up important data on C: drive before restoring the system
CHOICE /c:1234
IF ERRORLEVEL 4 GOTO RESET
IF ERRORLEVEL 3 GOTO GHO
IF ERRORLEVEL 2 GOTO BAK
IF ERRORLEVEL 1 GOTO DOS
:BAK
TH/Q
CLS
GHOST -CLONE,MODE=PDUMP,SRC=1:1,DST=H:\SYS\SYSTEM.GHO -SURE -Z9 -RB
GOTO END
:GHO
TH/Q
CLS
GHOST -CLONE,MODE=PLOAD,SRC=H:\SYS\SYSTEM.GHO:1,DST=1:1 -SURE -RB
GOTO END
:DOS
TH/Q
CLS
GOTO END
:RESET
TH/Q
CLS
RESET.COM
:END
Floor 11 Posted 2006-10-21 22:45 ·  中国 浙江 衢州 电信
银牌会员
★★★
Credits 1,270
Posts 548
Joined 2004-05-31 00:00
22-year member
UID 25754
Gender Male
Status Offline
The order is wrong. It should be 1. Boot to MS-DOS, 2. Automatically back up the C: drive, 3. Automatically restore the C: drive
Floor 12 Posted 2006-10-21 23:15 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
I'll improve the code on the 10th floor. tH should be tw, right?
@ECHO OFF
path c:\dosghost
tw
ECHO One - key system recovery
ECHO Please use the numeric keys to select the menu
ECHO.
ECHO 1. Automatically back up drive C:
ECHO 2. Automatically restore drive C:
ECHO 3. Boot to MS - DOS
ECHO 4. Restart the system
ECHO.
ECHO Note: Please back up important data on drive C: before restoring the system
CHOICE /c:1234
tw/q
CLS
IF ERRORLEVEL 4 RESET.COM
IF ERRORLEVEL 3 GOTO END
IF ERRORLEVEL 2 GOTO GHO
IF ERRORLEVEL 1 GOTO BAK
:BAK
GHOST -CLONE,MODE=PDUMP,SRC=1:1,DST=H:\SYS\SYSTEM.GHO -SURE -Z9 -RB
GOTO END
:GHO
GHOST -CLONE,MODE=PLOAD,SRC=H:\SYS\SYSTEM.GHO:1,DST=1:1 -SURE -RB
GOTO END
:END

[ Last edited by qwe1234567 on 2006-10-21 at 23:17 ]
Floor 13 Posted 2006-10-22 01:06 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
Thanks. Originally I just wanted to recover it.... I'll try again later.... I'll add a password to Ghost. That way, I won't accidentally let others press recover when using the computer......

config.sys cannot run ghost.exe; it needs to be added in autoexec.bat; does the version master's writing count as running in config?
Floor 14 Posted 2006-10-22 10:19 ·  中国 河南 许昌 长葛市 电信
新手上路
Credits 8
Posts 4
Joined 2006-10-22 09:43
19-year member
UID 67678
Gender Male
Status Offline
Thanks to the brothers upstairs!
Floor 15 Posted 2006-11-03 05:24 ·  中国 云南 楚雄彝族自治州 楚雄市 电信
初级用户
Credits 68
Posts 24
Joined 2006-06-26 17:06
20-year member
UID 57599
Status Offline
Thanks
Forum Jump: