Boot loader variables

Hello again! I'm already working on my next project with EasyBCD, this time with VistaPE. I've managed to get a slimmed down (36mb WIM) booting very quickly from a USB stick but now I have a question about the boot menu entries.

This is what I'm trying to do:

VistaPE + batch file 1
VistaPE + batch file 2

Both BCD entries are pointing to the same VistaPE.wim file and I want different batch files to run when VistaPE finishes booting depending on which option is selected from the menu. I want to avoid using 2 WIM images.

This would be possible if I could find a variable that is recorded when an item is selected from the menu (GUID for example). Does anyone know if this occurs during the boot process?
I've made a little progress today although I'm still stuck.

It appears that whichever option you choose from the menu, bcdedit is supposed to change the identifier to {current}. I've tested this by booting WinPE from a hard disk and it works, so this would be an ideal solution, but bcdedit refuses to run when I've booted WinPE from a USB drive. I think it has something to do with the drive letter. The hard drive is always given C: whereas the USB drive varies from E: to G: (depending on your drive set up) and bcdedit doesn't know what's going on.
Hi teamxtreme,

The BCD isn't meant for use as an arbitrary data storage, it's only used to contain specific boot-related info.

I don't think {current} would help you any, but you _should_ be able to get bcdedit to run by using the /store switch. i.e.:
bcdedit.exe /store x:\boot\bcd

Where X: is the WinPE ramdisk.

For what it's worth, you may be able to get some useful info by comparing the outputs of
bcdedit.exe /store x:\boot\bcd /enum
with the output of
bcdedit.exe /store X:\boot\bcd /enum /v
The first will output one of the entries labelled as {current} and the second will output a full GUID {xxxx-xxxx-....} instead of {current}.

By comparing the differences you can find out which entry has been booted.
Thanks for the reply Guru. For some reason I don't seem to have a Boot folder on the ramdisk. The only Boot folder is on my USB drive.

It looks like I'll have to settle for having 3 WinPE WIM images each with a different batch file.
Yeah, this is totally out of the realm of the boot manager.

However, what is it that you're trying to accomplish with the batch files? There should be a more elegant solution than 3 separate WinPE files - perhaps we can stumble across an alternative solution?
I have 3 ghost images on my USB drive and I want a menu with 3 options, 1 for each.

Ideally I want this option to be made before the system boots so the build process isn't interrupted.

The only thing that changes is the startnet.cmd in WinPE 2.0 which refers a different ghost file. All I want to do is find something that I can change in each BCD entry which filters through to WinPE (say a txt file or something) and then I can throw in an IF statement so that WinPE knows which batch file to run.

I could probably achieve this with NeoGRUB but I like to keep things simple by using as few tools as possible.

The only thing that changes is the startnet.cmd in WinPE 2.0 which refers a different
You could make it one WInPE file which prompts the end user to pick a ghost image immediately at startup with a graphic popup dialog (optionally taking up the whole screen)?
I did look into that, I had a great menu system setup for when I used to use ghost in DOS.. but WinPE 2.0 (Vista) doesn't have a 16bit subsystem so that was no good. It was very simple and easy to update.

Do you know of any menu systems I could use?
Why does it need to be 16-bit?
The WinPE environment has full MFC and ATL support, along with the usual win32 forms.
It doesn't have to be 16bit, that's just what I had already setup so it would've been very convenient.

I'm not much of a programmer, so scripting a menu in VB would take me a while. If you know of any scripts that would help, please let me know.