Jump to content

When Do We Get Our Hand into BOOT.INI?


Recommended Posts

Hi Friends,

My question is when during install we have the first chance of editing boot.ini?

I've unsuccessfully tried [setupParams] UserExecute= a batch file method to try editing it as late as T-9 stage but couldn't quite handle the case.

My target is simple: In a multi-boot scenario, after GUI mode setup & reboot thereafter , we get multi-boot menu with 30 secs time-out and default option of the just installed XP. While anybody has the liberty of selecting the other partition and boot that one, i want to forcibly change the time-out to zero, so that default XP boots right after the reboot. I used bootcfg command in the batch file in [setupParams] UserExecute, but failed miserably.

Is boot.ini drafted by setup after T-9 stage and during "Saving Settings" ?

How could it be possible to change the time-out to 0 before GUI mode setup leads to reboot?

I welcome any discussion into this problem. Looking forward to you...

@MOONLIGHT SONATA

Link to comment
Share on other sites


I don't understand all what you say because I'm french ... but

If you install windows on fresh disk you don't have the boot menu for 30s ...

I have an idea about your situation ... start unattended setup from windows but disable the autoreboot, after bootcfg boot.ini and reboot the machine. I don't remember if it's possible to disable autoreboot from windows into unattended.txt.

Link to comment
Share on other sites

Dear Sonic,

i explain little bit to make you understand what i mean...

In one partition Windows XP is already installed. Now, if after making the 2nd partition active, unattended install is done, after GUI mode setup finished, we get Multi-boot choice menu with 2 pre-conditioned defaults set. They are : 1> Time-out is set to 30 secs and 2> The Default OS which is highlighted & obviously the Default OS is the Newly installed one, I mean the one I've just installed in the 2nd partition. Now, imagine when the Boot choice Menu waits for user intervention as to boot into which OS, I or anybody can boot into the Windows XP that resides inside the 1st partition. I want to restrict that option. If after/during GUI Mode Setup, the Time-Out could be set to zero, then the newly installed Windows XP in the 2nd partition boots without waiting for any user's choice.

bootcfg /Timeout 0 command when executed from [setupParams] section of WINNT.SIF at T-9 stage, it doesn't produce the desired result.

Could you reflect upon where i'm doing wrong?

====MOONLIGHT SONATA

Edited by MOONLIGHT SONATA
Link to comment
Share on other sites

Well, I can only give a suggestion:

Make a batch-file to run at T-9 stage, which executes these commands:

start /wait cmd /K
PAUSE
exit

That will give you a command prompt which you could then use, to do whatever you like. This will show you the status of the file you want to checkout:

notepad c:\boot.ini

Or if you want to view how the boot.ini looks at any other point in setup, just press the debug key-combo. [sHIFT+F10]

And that will pop-up a command window, execute any batch-file or command you want after that!

Do post back your findings! :yes:

Link to comment
Share on other sites

Dear prathapml,

I tried. In the end i'm both amazed :) and annoyed :angry: . At the T-9 minute mark pressed debug key-combo and opened boot.ini in notepad. Successfully changed timeout to 0 and saved and closed notepad. Amazing experience. I'm annoyed just because bootcfg /Timeout 0 when executed from [setupParams] section, couldn't do the job for me. What's the reason? Two interesting things noted during the whole experience:

1. boot.ini is not read-only at that time. I got no warning when i saved it after editing.

2. When i'd gone through the exercise, there was still Windows XP installed in another partition. Even then, when i opened boot.ini, only the ongoing partition was located there. I apprehend the next partition information goes into the file at some later minutes.

Can you foresee any workaround in favour of hands-free editing of boot.ini before reboot? :}

Link to comment
Share on other sites

bootcfg /Timeout 0 when executed from [setupParams] section, couldn't do the job for me.
Could it be because it needs to be run from a command-line?

If so, then executing from setupparams will be something like:

cmd.exe /C "bootcfg /Timeout 0"

Can you foresee any workaround in favour of hands-free editing of boot.ini before reboot? :}
The only suggestion I can think of for now, is:

open the CMD & run the command - findstr timeout c:\boot.ini

Now to replace that 2nd line thru a batch-file, MUNGE.EXE might help - http://www.ss64.com/nt/munge.html (I haven't looked into writing a script for it, do tell me if worked....)

Link to comment
Share on other sites

Dear prathapml,

Well, your advice about findstr timeout c:\boot.ini works perfectly. I'll give munge.exe a try. Can you help me by providing a sample batch file which executes munge.exe commands specific to the required task? I'm asking you just because i failed in previous effort from [setupParams], although then i executed a .cmd file named editbini.cmd as UserExecute, which had bootcfg /timeout 0 as the desired task. May be my .cmd file had syntax errors. Could you find time?

Awaiting your kind response...

@MOONLIGHT SONATA

Link to comment
Share on other sites

@MOONLIGHT SONATA

I am running a (rather old) batch script from cmdlines called bootfix.bat:

bootfix.bat

@ECHO OFF
CMDOW @ /HID
IF NOT "%1"=="" GOTO EOF
ATTRIB -H -S -R %SystemDrive%\BOOT.INI
REN %SystemDrive%\BOOT.INI *.OLD
(FOR /F "tokens=1* delims==" %%A IN (%SystemDrive%\BOOT.OLD) DO IF "%%B"=="" (ECHO %%A) ELSE (IF /I "%%A"=="timeout" (ECHO %%A=0) ELSE (ECHO %%A=%%B)))>%SystemDrive%\BOOT.INI
ATTRIB +H +S +R %SystemDrive%\BOOT.INI
IF NOT EXIST %SystemDrive%\BOOT.INI (ECHO Restoring original BOOT.INI© %SystemDrive%\BOOT.OLD %SystemDrive%\BOOT.INI)
DEL /F /S /Q %SystemDrive%\BOOT.OLD
GOTO:EOF

It will copy the boot.ini file to a new file while setting the timeout to 0sec before the reboot.

Hope this helps :)

CF

Link to comment
Share on other sites

I found an alternative!

First download replace.exe from - http://www.bestcode.com/html/findreplace.html

Then, put that tool on your CD, & thru a batch-file, add the path to the EXE in the below command:

attrib -s -h -r %systemdrive%\boot.ini

start /wait PATH-TO-FILE\replace.exe -srcdir %systemdrive% -find "timeout=30" -replace "timeout=0" -fname boot.ini

NOTES:

The attrib is to strip unnecessary attributes from the file so that it can be edited.

The replace.exe utility is not perfect, since it forces file search even when you know exact path, but will do for now - just be prepared to allot 10 seconds for it to finish running.

Do inform us about how it goes, if its working now, if you have any other issue, etc. :yes:

Link to comment
Share on other sites

@Cancerface & prathapml & Yzowl,

:hello:

Many many thanks to 3 Musketeers for providing me with 3 different ways to handle this problem. Oops! I'm going to toss to decide which one to try first. But still I've one dilemma: As I want to try this method as late as possible, T-9 stage and [setupParams]|Userexecute is the late-est control point. Do you find any technical issues if it's executed from T-9 minute mark.

Anyway, I'll try all the 3 solutions seperately and surely do inform you and seek your advice thereafter.

Thanks, mates, you made my day today. So kind of you.

----MOONLIGHT SONATA

Link to comment
Share on other sites

@Cancerface & prathapml & Yzöwl,

Hey, i've finally tested out all the three ! :D

Dear prathapml,

replace.exe works well, but if not those ~10 seconds!. Anyway, it serves its purpose fully. Thanks for week long support that you've provided me. :)

@Cancerface

bootfix.bat has given me error not at run-time, but after reboot. Message was that of finding no boot.ini. I booted from BARTPE bootcd and really found that there's no boot.ini in SystemDrive. I find no apparent error in your bootfix.bat file, but in the end i've to swallow the error. No offence meant. Never mind!

Finally,

Dear Yzöwl,

As I expected, your advice works flawlessly. There's so much to learn whenever you post your code for us. In every interaction that we're fortunate to have with you, you surprise us by advising new and new ways to handle our problems. More and more we learn from you, more and more we realize how little our knowledge base is! Till date, i didn't find an iota of bug in scripts posted by you. And sorry, sometimes i do really search bug in your post just to believe that we interact with someone whose scripts not only have Midas touch, but also comes from someone who is more humane. Thanks, take my indebtness as my gratitude for these awsome scripts@Yzöwl. :thumbup

Edited by MOONLIGHT SONATA
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...