Login to Account Create an Account
When Do We Get Our Hand into BOOT.INI?
Posted 26 January 2006 - 12:23 AM
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...
Posted 26 January 2006 - 06:16 AM
Posted 29 January 2006 - 11:22 AM
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?
Posted 29 January 2006 - 06:43 PM
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.
Posted 30 January 2006 - 12:49 PM
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?
Edited by MOONLIGHT SONATA, 30 January 2006 - 12:51 PM.
Posted 30 January 2006 - 05:22 PM
Edited by sonic, 30 January 2006 - 05:22 PM.
Posted 30 January 2006 - 06:02 PM
Make a batch-file to run at T-9 stage, which executes these commands:
start /wait cmd /K PAUSE exitThat 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:
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!
Posted 04 February 2006 - 01:28 PM
I tried. In the end i'm both amazed and annoyed . 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?
Posted 04 February 2006 - 06:08 PM
Could it be because it needs to be run from a command-line?
bootcfg /Timeout 0 when executed from [SetupParams] section, couldn't do the job for me.
If so, then executing from setupparams will be something like:
cmd.exe /C "bootcfg /Timeout 0"
The only suggestion I can think of for now, is:
Can you foresee any workaround in favour of hands-free editing of boot.ini before reboot?
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....)
Posted 05 February 2006 - 11:36 AM
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...
Posted 05 February 2006 - 02:04 PM
I am running a (rather old) batch script from cmdlines called 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
Posted 05 February 2006 - 02:21 PM
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.iniNOTES:
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.
Posted 06 February 2006 - 11:43 AM
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.
Posted 12 February 2006 - 11:54 AM
Hey, i've finally tested out all the three !
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.
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!
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.
Edited by MOONLIGHT SONATA, 12 February 2006 - 11:56 AM.
Posted 15 February 2006 - 05:41 AM
@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....
P.S.: the line "type boot.ini | .....>> C:\boot.tmp" has to be on the SAME line
Edited by jaclaz, 15 February 2006 - 05:43 AM.
Posted 15 February 2006 - 01:44 PM
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,
in WINNT.SIF file really fixes the issue.
2. However, if our WINNT.SIF looks like below,
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,
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.
Edited by MOONLIGHT SONATA, 15 February 2006 - 01:46 PM.
Posted 16 March 2006 - 10:29 AM
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© %SystemDrive%\BOOT.OLD %SystemDrive%\BOOT.INI)
... I just spotted the difference the © 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
You're right, the script I posted is unreasonably complicated I think I picked it up from some site looooong time ago...
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.
Edited by cancerface, 21 March 2006 - 06:56 PM.
Posted 21 March 2006 - 06:56 PM
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 SystemStartupOptionsNote that the above were not tested upon building a machine ie I am not sure if wmic.exe is accesible via cmdlines ...
Edited by cancerface, 21 March 2006 - 06:57 PM.
Posted 22 March 2006 - 05:56 PM
ATTRIB -R -S -H %systemdrive%\boot.ini
del /F /Q %systemdrive%\boot.ini
ECHO [boot loader]>> %inifile%
ECHO timeout=4 >> %inifile%
ECHO default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS >> %inifile%
ECHO [operating systems] >> %inifile%
ECHO multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Professional" /noexecute=ALWAYSOFF /fastdetect >> %inifile%
ATTRIB +R +S +H %systemdrive%\boot.ini
Edited by Yurek3, 22 March 2006 - 05:57 PM.
Posted 23 March 2006 - 01:59 PM
If you change the line
ECHO [boot loader] >> %inifile%to
ECHO [boot loader] > %inifile%(taking out a > )
you can remove the line
del /F /Q %systemdrive%\boot.ini
from your batch.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users