MSFN Forum: When Do We Get Our Hand into BOOT.INI? - MSFN Forum

Jump to content


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

When Do We Get Our Hand into BOOT.INI? For The First Time ?! Rate Topic: -----

#1 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 26 January 2006 - 12:23 AM

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


#2 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,603
  • Joined: 04-December 03

Posted 26 January 2006 - 06:16 AM

You install windows in already windows environment ?

#3 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 29 January 2006 - 11:22 AM

@sonic,

Yeah, for multi-boot environment having an already installed Windows Xp in another partition, that's the case i'm thinking of. That's not the case of corporate environ, yet such may be the case for home computers. What's your idea for such a situation?

===MOONLIGHT SONATA

#4 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,603
  • Joined: 04-December 03

Posted 29 January 2006 - 06:43 PM

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.

#5 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 30 January 2006 - 12:49 PM

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

This post has been edited by MOONLIGHT SONATA: 30 January 2006 - 12:51 PM


#6 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,603
  • Joined: 04-December 03

Posted 30 January 2006 - 05:22 PM

Okay, why not use bootcfg command in cmdlines.txt ?

This post has been edited by sonic: 30 January 2006 - 05:22 PM


#7 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 30 January 2006 - 06:02 PM

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:

#8 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 04 February 2006 - 01:28 PM

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? :}

#9 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 04 February 2006 - 06:08 PM

View PostMOONLIGHT SONATA, on Feb 5 2006, 12:58 AM, said:

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"


Quote

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....)

#10 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 05 February 2006 - 11:36 AM

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

#11 User is offline   cancerface 

  • a n00b for life
  • PipPip
  • Group: Members
  • Posts: 135
  • Joined: 27-February 05

Posted 05 February 2006 - 02:04 PM

@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

#12 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 05 February 2006 - 02:21 PM

I found an alternative!
First download replace.exe from - http://www.bestcode....indreplace.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:

#13 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 05 February 2006 - 03:52 PM

Alternatively use GSAR (Global Search And Replace) Utility
gsar -stimeout=3 -rtimeout= -io %SystemDrive%\boot.ini &&attrib +r +s +h %SystemDrive%\boot.ini
You will probably only require the executable, gsar-1.12-bin\bin\gsar.exe from the zip file.

#14 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 06 February 2006 - 11:43 AM

@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

#15 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 12 February 2006 - 11:54 AM

@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

This post has been edited by MOONLIGHT SONATA: 12 February 2006 - 11:56 AM


#16 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,438
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 15 February 2006 - 05:41 AM

As every one has shared some knowledge, I'll throw my two cents in:
@ECHO OFF
REM ATTRIB -H -S -R C:\BOOT.INI
echo [Boot Loader] > C:\boot.tmp
echo Timeout=0 >> C:\boot.tmp
type boot.ini | FIND /V "[Boot Loader]" | FIND /V "Timeout=" >> C:\boot.tmp
Copy C:\BOOT.TMP C:\BOOT.INI > NUL
DEL C:\BOOT.TMP
REM ATTRIB +H +S +R C:\BOOT.INI

(you will need to UNrem the two remmed lines)

Maybe it's brutal, but no need for FOR loops, conditional statements or external utilities....;)

jaclaz

P.S.: the line "type boot.ini | .....>> C:\boot.tmp" has to be on the SAME line

This post has been edited by jaclaz: 15 February 2006 - 05:43 AM


#17 User is offline   MOONLIGHT SONATA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 203
  • Joined: 10-May 05

Posted 15 February 2006 - 01:44 PM

Dear jaclaz,

It's interesting. My earlier brush with a script from cancerface yielded no positive results. your and his looks a lot have in common. I'll give it a try, but i always test in real install instead of VMs. So, it'll take a couple of days as i've to get ready a few more things for the next install.

BTW, in this context i wish to mention a few more observations that may interest all of us. Here are they...

1. Just to fix timeout to 0 could be done without a script. I've noticed that setting,
[SetupData]
OsLoadTimeout=0

in WINNT.SIF file really fixes the issue.

2. However, if our WINNT.SIF looks like below,
[SetupData]
OsLoadTimeout=0
OSLoadOptionsVar="/noexecute=AlwaysOff"
OSLoadIdentifier="Windows XP SP2 UnAttended"

then, /noexecute=AlwaysOff gets inserted into Boot.ini but doesn't serve its purpose as boot.ini then looks like,

[boot loader]
timeout=0
default=multi(0)disk(0)rdisk(0)partition(4)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(4)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /noexecute=AlwaysOff /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn


So, disabling software-based DEP couldn't be handled properly as the default /noexecute=optin is enetred irrespective of what we set under OSLoadOptionsVar.

To me it seems that it's only fit for 64-bit edition, directly.

3. As for the OSLoadIdentifier="Windows XP SP2 UnAttended", it really doesn't take off at all. Boot.ini still shows only "Microsoft Windows XP Professional". No effect.

I'll much like if such things could be managed by a batch file as you, Yzowl and prathapml tried to formulate for the timeout issue.

Thanks.

This post has been edited by MOONLIGHT SONATA: 15 February 2006 - 01:46 PM


#18 User is offline   cancerface 

  • a n00b for life
  • PipPip
  • Group: Members
  • Posts: 135
  • Joined: 27-February 05

Posted 16 March 2006 - 10:29 AM

@MOONLIGHT SONATA
Sorry for the laaaaaate response but I did not keep up with this thread :(
Anyway, you didn't find anything wrong with the script I posted, but looking at the code just now I reallized that copy/paste in fact altered it a bit:

It should read:
IF NOT EXIST %SystemDrive%\BOOT.INI (ECHO Restoring original BOOT.INI© %SystemDrive%\BOOT.OLD %SystemDrive%\BOOT.INI)

yet if the above is entered within CODE tags it gives:
IF NOT EXIST %SystemDrive%\BOOT.INI (ECHO Restoring original BOOT.INI&COPY %SystemDrive%\BOOT.OLD %SystemDrive%\BOOT.INI)


... I just spotted the difference :) the &COPY becomes a copywrite sign © :)


I can confirm that the script works if run from cmdlines, although I run it right after I install recovery console (from cmdlines) ... Not sure if this changes things for you

CF



@jaclaz
You're right, the script I posted is unreasonably complicated :) I think I picked it up from some site looooong time ago...

[Edit]
The script came from Rob van der Woude's site and can be found here. There is also another version that may be of use to MOONLIGHT_SONATA here.

This post has been edited by cancerface: 21 March 2006 - 06:56 PM


#19 User is offline   cancerface 

  • a n00b for life
  • PipPip
  • Group: Members
  • Posts: 135
  • Joined: 27-February 05

Posted 21 March 2006 - 06:56 PM

Playing around with wmic.exe I saw that you can change some Boot.ini options.
In order to get a 0sec delay you can try:
%SystemRoot%\System32\Wbem\wmic.exe ComputerSystem Set SystemStartupDelay="0"

Also it seems that you can set the boot parameters as well as the name that appears on the boot menu with:
%SystemRoot%\System32\Wbem\wmic.exe Set SystemStartupOptions="<options>"

This however is a bit more complicated so you might want to try on a working machine the next in order to get an idea of what the SystemStartupOptions might be:
%SystemRoot%\System32\Wbem\wmic.exe Get SystemStartupOptions

Note that the above were not tested upon building a machine ie I am not sure if wmic.exe is accesible via cmdlines ...
CF

This post has been edited by cancerface: 21 March 2006 - 06:57 PM


#20 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,438
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 22 March 2006 - 01:11 PM

Command line usage help for WMIC.EXE:
http://www.ss64.com/nt/wmic.html

jaclaz

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy