Halfwalker

How to boot/install from USB key ?

486 posts in this topic

@wimb

This should work as well, takes into account multiple (if any) "=" but the main one, and is a bit more simple ;):

FOR /F "tokens=1,* delims==" %%A in ('TYPE %source%') DO (
IF /I "%%A"=="default" SET DefaultEntry=%%B
IF "%%A"=="!DefaultEntry!" SET EntryDesc=%%B
IF /I "%%A"=="timeout" SET Timeout=%%B
)

This works for simple boot.ini but the script needs more adjustment for boot.ini of BOOTFILES folder or other complex boot.ini

Please do post some examples of these boot.ini's so that I can adapt the code.

@ilko_t

Ok, I'll see what I can do with the Registry thingy.

jaclaz

0

Share this post


Link to post
Share on other sites

The second part of the script needs also some adjustment

FOR /F "tokens=1,2,3 delims==" %%A in ('TYPE %source%') DO (
IF /I "%%A"=="Default" SET DefaultEntry=%%B
IF "%%A"=="!DefaultEntry!" SET EntryDesc=%%B=%%C
IF /I "%%A"=="Timeout" SET Timeout=%%B
)
......
......
FOR /F "skip=4 tokens=1,2,3 delims==" %%A in ('TYPE %source%') DO (
IF NOT "%%A"=="!DefaultEntry!" (
ECHO %%A=%%B=%%C>>boot.txt
.......
........

A problem occurs when trailing spaces are present in the !DefaultEntry! string.

This occurs for the boot.ini in folder BOOTFILES

The traling spaces must first be removed.

Edited by wimb
0

Share this post


Link to post
Share on other sites

@wimb

Hey, I don't want to seem unfriendly, I am not, and at times I am also an extraordinarily friendly guy :), but when one asks (I guess politely) for something, like:

@wimb

Can you post an example of line where the "=" sign is used on the left of the "main" "=" sign for description?

Also, are there any cases where more than one "=" sign is used (besides the "main" one)?

and:

This works for simple boot.ini but the script needs more adjustment for boot.ini of BOOTFILES folder or other complex boot.ini

Please do post some examples of these boot.ini's so that I can adapt the code.

One expects two kinds of replies:

#1: Yes, here are the examples required.

#2: No, I will never post what you required.

(and all possible variations of the above)

Quite frankly telling me HOW I should correct a batch file I wrote, because it does not work with some entries of which I have not (and asked for twice) any example is a bit trying for my otherwise good manners.

However, should I have failed in explaining this before, can you please post some examples of boot.ini files that do not work with the tentative batch I posted?

jaclaz

0

Share this post


Link to post
Share on other sites

@jaclaz

@wimb

Can you post an example of line where the "=" sign is used on the left of the "main" "=" sign for description?

Also, are there any cases where more than one "=" sign is used (besides the "main" one)?

As fas as I know there is no boot.ini example with a line where the "=" sign is used on the left of the "main" "=" sign for description.

The standard boot.ini of Microsoft is a case where more than one "=" sign is used (besides the "main" one)

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect

In my posts #255 and #257 I indicated that the script does not work for the well known boot.ini of folder BOOTFILES

that we all use in the procedure for Install of Windows XP from a bootable USB-stick, as reproduced here:

7. Create a folder BOOTFILES in USB stick root, and copy NTDETECT.COM, NTLDR and create there your custom BOOT.INI, which will be copied on hard disk later, during the first logon. Set them system, hidden and read-only in advance.

BOOT.INI

CODE

[boot loader]

timeout=15

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Professional 0 1" /noexecute=optin /fastdetect

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="XP Professional 0 2" /noexecute=optin /fastdetect

multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="XP Professional 0 3" /noexecute=optin /fastdetect

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="XP Professional 1 1" /noexecute=optin /fastdetect

multi(0)disk(0)rdisk(1)partition(2)\WINDOWS="XP Professional 1 2" /noexecute=optin /fastdetect

multi(0)disk(0)rdisk(1)partition(3)\WINDOWS="XP Professional 1 3" /noexecute=optin /fastdetect

It is not easy to find, why the script does not work for this paticular boot.ini

But when you select the boot.ini you can see there is a trailing space in the line with the entry default.

It is this trailing space which causes the problem,

because it becomes part of the seach string !DefaultEntry! used to determine EntryDesc according to:

IF "%%A"=="!DefaultEntry!" SET EntryDesc=%%B

Due to the trailing space, the search gives no valid result for EntryDesc

When I was writing this result in my post #257, your post #256 was not yet on my screen visible,

but came up after submitting the post. So this explains why I missed your request at that time.

But anyway I indicated in my posts #255 and #257 that the script does not work for the well known

boot.ini of folder BOOTFILES.

Edited by wimb
0

Share this post


Link to post
Share on other sites

@jaclaz

Assumption was: If %systemdrive%\boot.ini exist, this indicate "definitive" boot.ini.

If %systemdrive%\boot.ini dosn't exist, but C:\boot.ini exist, use C:\boot.ini.

Assumption was not: %systemdrive% contain boot.ini.

A logical partition dosn't cotain a d:\boot.ini by default.

Of course there can exist a c:\boot.ini and a d:\boot.ini.

Assumption will fail at this case.

And there can be several primary partitions.

Each primary partition can hold a different boot.ini.

Assumption may fail too.

Assumption c:\boot.ini is fine in most cases.

Contrary the "definitive" boot.ini is not always on C:\.

Remember the RAM loaded install solution: Primary Active Partition of First Hard Disk got D:

What about several internal hard disk including internal card readers?

I recall another windows installation was not at c: Sorry I don't remember details anymore.

Given a grub4dos MBR, "definitive" boot.ini can be at diferent drive letters.

Contrary most likely after Windows installtion, there is a default MS MBR.

No problem if I can access the DosDevices key of the Registry, what I am not sure about is if at the time the batch is meant to run the Registry is accessible (I suppose not) and if the proper entry has already been written to the key.

Textmode setup write a false rdisk(), first reboot fails.

Batch should run at end of textmode setup.

@ilko_t and wimb

Dosn't this replace bootfiles\boot.ini?

Call jaclaz's batch at [setupParams] UserExecute = "%systemdrive%\windows\system32\boot_ren.cmd" ?

@jaclaz

Just wondering: Rename %SysteDrive% early at installation?

Currently I don't know if this is useful, but maybe I need this one day.

At end of textmode setup:

What happens if DosDevices key in Registry is chaned from c: to d:, or from d: to c: ?

E.g. is there full path to Userinit.exe already?

Compare http://support.microsoft.com/kb/249321/

0

Share this post


Link to post
Share on other sites

@all

Please find attached a 2nd tentative version of the batch file.

Unlike the first version, this will ONLY work with a BOOT.INI on root of a drive (or in a path without spaces in it)

Solved three problems:

1) one or more "=" signs on the right of the "main" one

2) one or more leading or trailing spaces in entry or entry description

3) empty lines

Added backup feature for original BOOT.INI, saving a maximum of three versions.

@cdob

I'll look at your suggestions, I have not yet a complete and definite idea on how to find the right drive.

There is a key in Registry:

HKEY_LOCAL_MACHINE\SYSTEM\Setup\SystemPartition

where this values are set:

"SetupType"=dword:00000000

"SystemSetupInProgress"=dword:00000000

"CmdLine"="setup -newsetup"

"SystemPrefix"=hex:c2,0b,00,00,00,40,3f,20

"SystemPartition"="\\Device\\HarddiskVolume1"

"OsLoaderPath"="\\"

Though illogical as it may seem, the "SystemPartition" actually appears to represent the "Boot" partition, as opposed to %SystemRoot%.

"\\Device\\HarddiskVolume1" is a "symbolic" link for which I have not found (at least yet ;) ) a way through pure batch and through "normal" XP included command line tools.

One could however use the vlm.exe utility (part of the DSFOK toolkit) to "couple" this link to actual drive letter.

Otherwise we are back to "square 1" with DMDIAG.EXE.

I would greatly prefer to only use "standard" tools, so any idea is welcome, maybe this is possible through a .wbs script?

jaclaz

P.S.: Please someone have a look at this batch:

http://www.robvanderwoude.com/bootdrive.html

(I have not handy a XP machine right now)

Does this return "System" or "Boot" drive?

binifix2.zip

Edited by jaclaz
0

Share this post


Link to post
Share on other sites
@ilko_t and wimb

Dosn't this replace bootfiles\boot.ini?

Call jaclaz's batch at [setupParams] UserExecute = "%systemdrive%\windows\system32\boot_ren.cmd" ?

The version of binifix2.cmd will not yet be able to replace the use of bootfiles\boot.ini

because then the signature problem with 20 sec bootdelay described in my post #141 will return:

Replacing signature(87538753)disk(0)rdisk(0)partition(1)\WINDOWS by

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS in the boot.ini file and removing the second entry,

solved the problem and now the computer is booting as fast as normally

Also the availability of the Repair Install option of Windows XP Setup from a bootable USB-stick

still requires such a multi-entry boot.ini

But in most cases one does not need this Repair Install option and one can change boot.ini if needed.

Actually I had no problem with the value of rdisk.

The GUI-Phase of Setup always made the correct value of rdisk(0) in boot.ini

For me the problem was that the default entry was set to signature(87538753)... entry, which gives bootdelay.

So I am a bit confused about the purpose of the present binifix.cmd

[setupParams] runs at T-9 and that seems a suitable moment to use binifix.cmd, but I am not sure.

I remember that ilko_t observed that boot.ini is changing many times during setup.

Testing of the final version of binifix.cmd will be necessary to determine if this moment is right,

or that we use [GuiRunOnce] at First Logon.

@jaclaz

After changing drive W: into C: the binifix2.cmd was tested on two boot.ini files

All boot.ini files were modified correctly and the problem of trailing spaces is solved.

It is nice that a backup of boot.ini is made now as well.

After some modification for unattended use,

it will be interesting to use the final version of binifix.cmd in a real Install of Windows XP from bootable USB-stick.

Edited by wimb
0

Share this post


Link to post
Share on other sites

@wimb

Could not the batch file provide a way to automatically get rid of the signature(aabbccdd) line of your post #141?

If I get it right, that line gets the correct rdisk(z), and as so it would just be a matter of replacing signature(aabbccdd) in the lines with multi(0).

As "normally" there are no entries with signature(aabbccdd) syntax in boot.ini, if one is found it should always be the one created by the install.

Just to be on the safe side one could just correct the default entry and duplicate the [Operating Systems] one, leaving one entry with the multi(0) and one with the signature(aabbccdd) syntax that could be manually selected in case the "direct" one, for any reason, won't boot.

jaclaz

0

Share this post


Link to post
Share on other sites
@wimb

Could not the batch file provide a way to automatically get rid of the signature(aabbccdd) line of your post #141?

If I get it right, that line gets the correct rdisk(z), and as so it would just be a matter of replacing signature(aabbccdd) in the lines with multi(0).

As "normally" there are no entries with signature(aabbccdd) syntax in boot.ini, if one is found it should always be the one created by the install.

Just to be on the safe side one could just correct the default entry and duplicate the [Operating Systems] one, leaving one entry with the multi(0) and one with the signature(aabbccdd) syntax that could be manually selected in case the "direct" one, for any reason, won't boot.

jaclaz

The present binifix2.cmd does not change the signature entry, it only changes rdisk(1) in rdisk(0)

You are perfectly right that rdisk(0) need not to be changed for me and that it will be just a matter of replacing signature(aabbccdd) in the lines with multi(0) .

It would be very nice if the binifix2.cmd can be a way to change that.

For the [Operating Systems] I got two lines which became equal after I changed signature(87538753) in multi(0),

so I removed the "double" one. That seems to me always save for a new install,

but for a Repair Install your save solution can be interesting.

But it might be that in the configuration of ilko_t with SATA drives it is different,

but I think he will comment on that.

Edited by wimb
0

Share this post


Link to post
Share on other sites

@wimb

Please try the attached binifix3.cmd

Changes:

1) Replaces (if Default entry)

signature(aabbccdd)disk(0)rdisk(z)partition(w)\windir

with:

multi(0)disk(0)rdisk(z)partition(w)\windir

Both in default entry and in [Operating Systems]

2) Writes original entry in [Operating Systems]:

signature(aabbccdd)disk(0)rdisk(z)partition(w)\windir="Some description" /some parameters

modified as follows:

signature(aabbccdd)disk(0)rdisk(z)partition(w)\windir=(signature) "Some description" /some parameters

This should cover all cases :unsure:, I guess that the user that uses this "experimental" way will be able to delete the (signature) entry from boot.ini manually once the new "default" one has proved to be working.

jaclaz

P.S.: Just found a smaller problem in binifix3.cmd

Removing the attachment, will re-add it later, as soon as I fix it.

OK, now it should work. :)

binifix3.zip

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

I am sorry to say, but I have made a mistake.

Today I made a Fresh Install from USB-stick without the xcopy command for bootfiles folder with boot.ini

The boot.ini that was produced by the Install procedure is given:

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

As you can see there is no longer a signature entry and I have now also to correct the rdisk(1) to rdisk(0)

I was not aware of this change caused by the renewals that the Install Procedure has undergone.

I never saw this before because I was always using the procedure with the xcopy of bootfiles folder included.

So the signature and bootdelay problem no longer exists and we can return to the code of binifix2.cmd

And that means indeed that your code can replace the use of the xcopy of bootfiles\boot.ini

as cdob already suggested.

The effects of different Booting procedures are complicated and sometimes not to be foreseen.

I must apologise for the confusion that I have made.

Edited by wimb
0

Share this post


Link to post
Share on other sites
I must apologise for the confusion that I have made.

No need whatsoever to apologize, your contributions have been and are of the max importance. :)

However, since the binifix3.cmd has the same functionalities of binifix2.cmd, one could stay with it, just in case some other user, with different/strange BIOS or something else, should come out with a signature(aabbccdd) entry in boot.ini.

jaclaz

0

Share this post


Link to post
Share on other sites
However, since the binifix3.cmd has the same functionalities of binifix2.cmd, one could stay with it, just in case some other user, with different/strange BIOS or something else, should come out with a signature(aabbccdd) entry in boot.ini.

binifix3.cmd was tested on the 4 different boot.ini files and everything is OK !

Thanks

wimb

Edited by wimb
0

Share this post


Link to post
Share on other sites

Hi guys,

let me remind you this post of mine, which kinda summarizes the options about boot.ini:

@jaclaz - what we need is a way to get the proper ARC path is it would be seen if no USB stick's BOOT.INI is used to call the GUI mode, find in what directory windows was placed in and amend or create a new BOOT.INI.

The issues I can see:

- bootcfg.exe doesn't change entries when working in this mode, it works as if run in normal XP environment. So no options to add boot entries.

- If GUI setup is called by ntldr/ boot.ini on the stick, hard disk is seen by GUI SETUP and supposedly by any suitable tool for getting ARC path as HD1, instead of HD0.

- If Grub mapping is used (hd0->hd1 and hd1->hd0) boot.ini will be created by Setup with the proper ARC path, but with a signature, which we liked to avoid. May be a script can replace the signature part with "multi", resulting in proper boot.ini? Can you do it by script?

signature(de33eaf8)disk(0)rdisk(0)partition(1)\WINDOWS ---> multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Menu.lst in this case would be like:

map --read-only (hd0) (hd1)
map --hook
root (hd1,0)
chainloader (hd1,0)/ntldrstp

restricting us to one hard disk only, if one plans to install it on another, mapping should be modified, which is a bit restricting. Thats why I preferred not to use mapping at all.

In summary: with mapping- signature part must be removed and Menu.lst amended if use more than 1 HD.

With no mapping- "universal" boot.ini must be used on both USB stick and the one we copy to hard disk.

Next few days I will be working on cdob's ideas.

BTW you mean bootcfg.exe, not bootfix.bin, right?

I'd like to avoid GRUB mapping, now we can also directly invoke setup by modified bootsector, meaning no GRUB at all.

If the batch file, which subtracts rdisk value is used wimb is right, this installation won't be seen as available for repair. To include this situation as well may we add an option to the batch script, something like:

would you like to include an entry for repair from USB?

If yes- leave the original entry with rdisk(z) and may be rename it to something like "only for USB repair, do not use to boot", change the default line to rdisk(z-1), and add the line with rdisk(z-1) under [operating systems]. If no- do not leave the old entry, just use the script we already got.

My idea about the choice is to leave boot.ini as simple as possible if one prefers, what do you think?

Folder bootfiles is no longer needed.

I can't recall and can't recreate the problem when on some installations the bootfiles didn't go to hard disk's first active partition, may be at that setup USB stick was seen as such during that stage of setup, and it placed or tried to place them on stick's root. To be on the safe side then I decided to copy them to hard disk anyway, this may not be necessary. It might have been when mixed SATA/IDE disks were used, now we know how to avoid the issue. For now I think we don't need to copy bootfiles again, also the script we are going to use assumes boot.ini is present on hard disk, which means ntdetect.com and ntldr will be there too.

The SATA disks should be no issue if no IDE drive/controller is present or it's disabled.

I am away for 2 weeks and as soon as I come back to my PC will make final tests and write an updated guide, I believe what we have gives us now pretty much "universal" way to install and repair XP from USB stick.

BTW have anyone tried this guide for USB hard disk? If I am right the USB disk should be seen as fixed, therefore listed first when TXT SETUP searches for disks, if that's the situation then we might need to go back to bootfiles folder or back to the option to create brand new boot.ini and copy ntdetect.com and ntldr, also a backup and later restore of boot.ini on USB disk might be needed.

Regards,

ilko

0

Share this post


Link to post
Share on other sites
If the batch file, which subtracts rdisk value is used wimb is right, this installation won't be seen as available for repair. To include this situation as well may we add an option to the batch script, something like:

would you like to include an entry for repair from USB?

If yes- leave the original entry with rdisk(z) and may be rename it to something like "only for USB repair, do not use to boot", change the default line to rdisk(z-1), and add the line with rdisk(z-1) under [operating systems]. If no- do not leave the old entry, just use the script we already got.

My idea about the choice is to leave boot.ini as simple as possible if one prefers, what do you think?

No prob, I'll add the option to keep the "USB Repair" entry in the batch.

Just an abstract idea, mind you, but we could make a second batch to "clean" the BOOT.INI from the signature(aabbccdd) and "USB repair" option entries on second boot, i.e. once the user is certain that the procedure worked.

For now I think we don't need to copy bootfiles again, also the script we are going to use assumes boot.ini is present on hard disk, which means ntdetect.com and ntldr will be there too.

You are right, I'll add this check to the batch.

I am away for 2 weeks and as soon as I come back to my PC will make final tests and write an updated guide, I believe what we have gives us now pretty much "universal" way to install and repair XP from USB stick.

Have fun and relax. :)

BTW have anyone tried this guide for USB hard disk? If I am right the USB disk should be seen as fixed, therefore listed first when TXT SETUP searches for disks, if that's the situation then we might need to go back to bootfiles folder or back to the option to create brand new boot.ini and copy ntdetect.com and ntldr, also a backup and later restore of boot.ini on USB disk might be needed.

I am not sure I fully understand this last part, but I think that if anything changes between USB stick and USB Hard Disk, we can make a detection in the batch for the type of media and have a conditional execution of different instructions.

jaclaz

0

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.