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-06-25 03:27
中国DOS联盟论坛 » GRUB4DOS、SYSLINUX及其它启动管理软件讨论专区 » Script for installing/uninstalling GRUB4DOS in the boot entries of Windows 2000/xp/2003/vista View 3,390 Replies 12
Original Poster Posted 2008-02-20 09:49 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Scripts for Installing/Uninstalling Grub4DOS in the Boot Entries of Windows 2000/xp/2003/vista

Instructions:
1. The following installation/uninstallation scripts are simplified from my "GGhost One - Click Recovery 2008".
2. Support Windows 2000/xp/2003/vista. Support systems of any language.
3. The display name in the boot entry is "Start Grub4DOS", with a delay of 3 seconds, which can be modified by yourself.
4. All file copying is removed, please copy grldr.mbr, grldr and other required files by yourself.
5. The third - party tool inifile.exe is used under Windows 2000/xp/2003. (Requires to be placed in d:\ggho)
(Those who need it can download from the network disk: http://lianjiang2004.ys168.com/)

I am not good at batch processing, and the shown scripts are for reference only.
http://gghost.uu1001.com/
=============================
@Echo Off
if not %os%.==Windows_NT. goto not_nt
cls
mode con: cols=76 lines=26
Set TT=Installation Program by lianjiang
COLOR f9
TITLE %TT%
set gname=Start Grub4DOS
set gname2=\grldr.mbr
set winver=
set ggpath6=
set ggpath0=d:\ggho

set vid=
set timeout=3
ver|find /i " 5.1">nul &&set winver=winnt&&goto sub_001
ver|find /i " 6.0">nul &&set winver=vista&&goto sub_003
ver|find /i " 5.0">nul &&set winver=winnt&&goto sub_001
ver|find /i " 5.2">nul &&set winver=winnt&&goto sub_001
:not_nt
cls
echo.
echo Sorry, this software cannot be used in non - Windows 2k/xp/2k3/vista environments.
PING/n 5 127.1>NUL
Goto Exit
:sub_001
set ggpath6=
for %%B in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do (
if exist %%B\boot.ini set ggpath6=%%B&&goto inst
)
goto inst
:sub_003
set ggpath6=%systemdrive%
:inst
if not %winver%#==winnt# goto vista_1
:winnt_1
attrib %ggpath6%\boot.ini -r -h -s >nul
if not exist %ggpath6%\g_boot.ini Copy %ggpath6%\boot.ini %ggpath6%\g_boot.ini /y >nul
%ggpath0%\inifile %ggpath6%\boot.ini timeout=%timeout% >nul
%ggpath0%\inifile %ggpath6%\boot.ini %ggpath6%%gname2%="%gname%" >nul
attrib %ggpath6%\boot.ini +r +h +s >nul
attrib %ggpath6%\g_boot.ini +r +h +s >nul
goto exit
:vista_1
if not exist %ggpath0%\nul md %ggpath0% >nul
bcdedit >%ggpath0%\temp_bcd.txt
type %ggpath0%\temp_bcd.txt | find "%gname%" >nul && goto vista_bcd
bcdedit /export "%ggpath0%\Bcd_Backup" >nul
bcdedit /create /d "%gname%" /application bootsector >%ggpath0%\vid.ini
for,/f,"tokens=2 delims={",%%i,In (%ggpath0%\vid.ini) Do (
set vida=%%i
)
for,/f,"tokens=1 delims=}",%%i,In ("%vida%") Do (
set vid={%%i}
)
echo %vid%>%ggpath0%\vid.ini
bcdedit /set %vid% device partition=%ggpath6% >nul
bcdedit /set %vid% path %gname2% >nul
bcdedit /displayorder %vid% /addlast >nul
:vista_bcd
bcdedit /timeout %timeout% >nul
:exit
cls
echo.
echo Installation completed.
echo.
echo Please copy grldr.mbr and grldr to %ggpath6% by yourself
Echo.
PING/n 3 127.1>NUL

=============================
@Echo Off
if not %os%.==Windows_NT. goto not_nt
cls
mode con: cols=76 lines=26
Set TT=Uninstallation Program by lianjiang
COLOR f9
TITLE %TT%
set winver=
set ggpath6=
set ggpath0=d:\ggho
set vid=
set timeout=3
ver|find /i " 5.1">nul &&set winver=winnt&&goto sub_001
ver|find /i " 6.0">nul &&set winver=vista&&goto sub_003
ver|find /i " 5.0">nul &&set winver=winnt&&goto sub_001
ver|find /i " 5.2">nul &&set winver=winnt&&goto sub_001
:not_nt
cls
echo.
echo Sorry, this software cannot be used in non - Windows 2k/xp/2k3/vista environments.
PING/n 5 127.1>NUL
Goto Exit
:sub_001
set ggpath6=
for %%B in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do (
if exist %%B\boot.ini set ggpath6=%%B&&goto uninst_01
)
goto uninst_01
:sub_003
set ggpath6=%systemdrive%
:uninst_01
if not %winver%#==winnt# goto uninst_4
for,/f,"tokens=1",%%i,In (%ggpath0%\vid.ini) Do (
set vid=%%i
)
bcdedit /delete %vid% /cleanup >nul
bcdedit /timeout %timeout% >nul
goto uninst_4a
:uninst_4
attrib -h -r -s %ggpath6%\boot.ini >nul
if exist %ggpath6%\boot.ggh attrib -h -r -s %ggpath6%\boot.ggh >nul&&del %ggpath6%\boot.ggh >nul
ren %ggpath6%\boot.ini boot.ggh >nul
findstr /b /i /v /c:"%ggpath6%\grldr" %ggpath6%\boot.ggh>%ggpath6%\boot.ini
bootcfg /timeout %timeout% >nul
attrib +h +r +s %ggpath6%\boot.ini >nul
del %ggpath6%\boot.ggh >nul
if exist %ggpath6%\g_boot.ini attrib %ggpath6%\g_boot.ini -r -h -s >nul&&del %ggpath6%\g_boot.ini >nul
:uninst_4a
cls
echo.
echo Uninstallation completed.
Echo.
PING/n 3 127.1>NUL
Windows 一键还原
http://www.yjhy.com
Floor 2 Posted 2008-02-20 12:38 ·  中国 福建 厦门 电信
中级用户
★★
Credits 480
Posts 197
Joined 2006-09-20 00:40
19-year member
UID 63115
From 黄冈
Status Offline
Give it a support

Seeing if for in batch processing makes my head spin

o(∩_∩)o...
Floor 3 Posted 2008-02-22 21:38 ·  中国 四川 绵阳 电信
初级用户
Credits 70
Posts 29
Joined 2006-01-03 06:17
20-year member
UID 48342
Gender Male
Status Offline
Support, take a look slowly...
Floor 4 Posted 2008-02-23 10:44 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
The number of supporters is too small, heh heh.
Windows 一键还原
http://www.yjhy.com
Floor 5 Posted 2008-02-23 17:46 ·  中国 河南 新乡 电信
新手上路
Credits 10
Posts 5
Joined 2007-04-14 09:44
19-year member
UID 85121
Gender Male
Status Offline
Originally posted by lianjiang2004 at 2008-2-23 10:44 AM:
There are too few supporters, heh heh.



o(∩_∩)o...
Well, technology is definitely not that easy to understand, so there are naturally fewer people, heh heh
Hard work, even though I'm a novice, I still have to tackle it
Heh heh
Floor 6 Posted 2008-02-25 17:38 ·  中国 广东 深圳 联通
初级用户
Credits 89
Posts 36
Joined 2007-12-20 15:37
18-year member
UID 106247
Gender Male
Status Offline
INIFILE is well used!!!
(Previously, I found this tool in the DOS71 installation floppy disk, never paid attention to it, and it turns out it has quite a few functions. Thanks to the楼主!)

Originally, I wanted to make a batch script that is universal for DOS, WIN98, NT, ME, 2000, XP, 2003, Vista to add GRUB4DOS menu. It seems that it is best to be completed by the楼主.


It's dizzying to look at........

There seems to be a small bug in the楼主's program:

if not %os%.==Windows_NT. goto not_nt

:not_nt
cls
echo.
echo Sorry, this software cannot be used in non-Windows 2k/xp/2k3/vista environments.
PING/n 5 127.1>NUL
Goto Exit

:exit
cls
echo.
echo Installation completed.
echo.
echo Please copy grldr.mbr and grldr to %ggpath6% by yourself
Echo.
PING/n 3 127.1>NUL

In this way, even if it is judged that the system does not meet the requirements, it will still display the words "Installation successful...".


In addition, there seems to be another small problem:
There is no judgment on the highest operating system in the computer (I have been unable to succeed for this reason) and corresponding processing.
For example: If there are XP and Vista installed on the computer, when running the above program, if the user is in XP, the program will continue and install the GRUB4DOS menu in boot.ini instead of the boot menu of Vista. This may be a bit improper.


(Looking forward to the楼主 making a universal one...)
Floor 7 Posted 2008-02-25 18:08 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
1. Regarding the prompt issue of judging non-NT systems, this is indeed a bug. I didn't pay attention when writing it. Thank you for pointing it out.
2. My handling method should be no problem. Judging the current system and performing installation is reasonable.
3. As for supporting DOS, 98, ME, etc., personally, I think it's basically meaningless.
Windows 一键还原
http://www.yjhy.com
Floor 8 Posted 2008-02-27 15:22 ·  中国 广东 深圳 联通
初级用户
Credits 89
Posts 36
Joined 2007-12-20 15:37
18-year member
UID 106247
Gender Male
Status Offline

2. My handling method should be no problem. Judging the current system and carrying out the installation is reasonable.


When the highest system in the computer is VISTA, but after adding the GRUB4DOS menu to BOOT.INI in XP, this menu will appear in both the VISTA and XP (BOOT.INI) menus. Personally, I feel this is unpleasant, or rather, not perfect.


3. As for supporting DOS, 98, ME, etc., personally, I think it is basically meaningless.

Indeed, as you said, I also think it is meaningless.
Floor 9 Posted 2008-02-27 16:12 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
For this kind of dual - system installation method, if you feel uncomfortable with the appearance of two options, you don't need to install in Vista.
Windows 一键还原
http://www.yjhy.com
Floor 10 Posted 2008-02-27 18:09 ·  中国 湖北 武汉 武昌区 电信
中级用户
★★
Credits 452
Posts 202
Joined 2006-12-21 13:46
19-year member
UID 74161
Gender Female
Status Offline
I didn't install OneKey Recovery 2008. After running, I found a small problem as follows:

[boot loader]
timeout=3
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
C:\mxldr=MaxDOS v5.8s
C:\MAOTAO\MAOTAO.BIN="WinPE By: 老毛桃"
c:\grldr= grub 4d
c:\CGDos=Auto Ghost 1.

You will find that c:\grldr= grub 4d is missing a few words. I don't know if it's an isolated phenomenon.
Floor 11 Posted 2008-02-27 18:23 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
The first time I saw a report of this situation. It seems there's no reason for it to happen, heh heh.
Might as well manually enter the line to add grldr in cmd and see.
It seems you've modified it yourself, not sure which parts you've changed.
Windows 一键还原
http://www.yjhy.com
Floor 12 Posted 2008-03-08 19:25 ·  中国 辽宁 沈阳 联通
初级用户
Credits 48
Posts 23
Joined 2008-01-10 09:10
18-year member
UID 108163
Gender Male
Status Offline
The grldr has the same name as the file that cracks Vista.
Floor 13 Posted 2008-03-08 19:41 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
This is not a problem with grub, but rather a problem with the cracker randomly using file names.
Windows 一键还原
http://www.yjhy.com
Forum Jump: