Jump to content

(help) custom boot selection


vinifera

Recommended Posts

so let me explain

 

yes I slimmed down my win7 as much as I could at the expence of any recovery

SO my question would be this

 

how to do this:

 

DVD boots into a DOS/BAT type program where I have 2 selections to choose

 

1. Install Windows

2. Recovery

 

if 1. is selected, the win setup starts

if 2. is selected, it would invoke 7zip cmd line arguments to extract specific folders from install.wim

 

and here lies the problem

- how can CMD environment variables detect what letter is CD/DVD drive and parse it to 7zip cmd line

- how can CMD environment variables detect %SYSTEMDRIVE% and parse it as temp variable to 7zip to extract files to

----

 

i have never done this nor I know how

yet instead using some custom PE, I think this is fastest and easiest, but again I don't have knowledge of that

 

any help ? :P

 

Link to comment
Share on other sites


If you make your own WinPE, it will boot to a command prompt by itself. This is handled by the startnet.cmd where you can put in your own menu.

For modifying a Setup boot.wim, I'm not sure. I never figured out how that worked exactly.

For using a winre.wim, you can add custom actions to the RECENV menu, as mentioned here:

http://www.msfn.org/board/topic/142990-installing-windows-7-from-recovery-partition/#entry918385

Link to comment
Share on other sites

DVD boots into a DOS/BAT type program

Mount the file \sources\boot.wim

Add a file <boot.wim>\Windows\system32\Winpeshl.ini

[LaunchApps]%SystemRoot%\setup.cmd
Add a file <boot.wim>\Windows\setup.cmd

Unmount the file boot.wim. Create a new ISO file.

 

DVD boots into a DOS/BAT type program where I have 2 selections to choose

1. Install Windows

2. Recovery

http://www.robvanderwoude.com/userinput.php#W2K

 

- how can CMD environment variables detect what letter is CD/DVD drive

rem Windows 7 and up http://technet.microsoft.com/library/dd744592.aspxWpeutil.exe WaitForRemovableStorageWpeutil.exe UpdateBootInfoset PEBootRamdiskSourceDrive=for /f "tokens=1-3 delims== " %%a in ('reg.exe query "HKLM\SYSTEM\CurrentControlSet\Control" /v "PEBootRamdiskSourceDrive" 2^>nul') do (  if %%a.==PEBootRamdiskSourceDrive. @set PEBootRamdiskSourceDrive=%%~dc)if Defined PEBootRamdiskSourceDrive (   echo PEBootRamdiskSourceDrive %PEBootRamdiskSourceDrive%)

- how can CMD environment variables detect %SYSTEMDRIVE%

That's simple: %SYSTEMDRIVE% is x:, the ramdisk ;)

Search for a special tag file at hard disk to detect the local windows partition.

Link to comment
Share on other sites

A "tag"  file simply refers to really any file you know is going to be on the source that you need. It can be any file as long as it is only on the disk you need not others! 

 

For example Windows XP looks for these files during setup to know where to get all of the files it needs from the disk.

 

post-6960-0-28270200-1448522892.png

 

Win51 tells it that it is a Windows XP disk

 

Win51IP says it is a pro disk

 

Win51IP.SP3 is added when you slipstream SP# This is the key thing here <--

 

While setup os being ran it looks for the files it needs and to see where they are (Disk Letter) It looks for the file. So when setup os ran and it needs to copy the 5,000+ files it searches the disks for the "ident" files. Looking specifically for win51, finds that and sets the driver letter then uses that in all of the variables to know where the files are.

 

What he is saying you need to set your drive letter by having your script look for a ident file that you designate. We used to do it with WPI. Any simple file will do it doesn't have to have a extension it just needs to be unique. 

 

Here is a example when we were adding WPI to a XP disk:

 

@ECHO OFFREMREM WPI startup something.REM REM Example, how to look for CDROM-drive. Must have a file called WIN51 in its root.for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\WIN51 set CDROM=%%i:echo Found CD-Rom as drive %CDROM%REM Determine the WPI startup path. REM If WPI should run off the CD the replace %dp0 with %CDROM%\PathToWPIset WPIPATH=%~dp0echo WPI will run from %WPIPATH%REM Font installation - the easy wayfor /R %%i in ( *.ttf ) do ( echo Installing font %%~ni.ttf copy /Y "%%~fi" "%windir%\Fonts" > nul "%WPIPATH%\common\installfont.exe" "%windir%\Fonts\%%~ni.ttf" > nul)REM Hide this command window"%WPIPATH%\common\cmdow.exe" @ /HIDREM Special registry tweak neededregedit /S "%WPIPATH%\common\wpi.reg"REM Make WPI driectory the current directoryfor /F "delims=: tokens=1" %%i in ("%WPIPATH%") DO echo %%i:cd "%WPIPATH%"REM Start WPI and wait for its endstart /wait WPI.htaREM call any cleanup code here, or after this script.exit

If you look at the first few lines you can see where it searches for "win51' and sets the drive number.... Hope this helps

:end
Link to comment
Share on other sites

you say its always X:

boot.wim is mapped as X: by default. This default can be changed, can be anoher letter.

As long as you use default boot.wim: its X:

 

but I am searching for "installed OS"

you say search for "special tag file"

Yes, I did understood "installed OS".

How many systems do you like to support.

Any multi boot machines with several windows?

A "special tag file" offers a secure approach: create a file yourself: \windows\special_tag_file.txt

This file is once at hard disk, and you can find this windows installation.

Or use a default existing file, e.g. \Windows\Media\tada.wav

This file is missing in boot.wim, won't exist at ramdisk.

Be aware, this may match several locations at a multi windows installation

And this will fail, if the default file is deleted.

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\Windows\Media\tada.wav set win_dir=%%i:\Windowsecho Windows folder at %win_dir%

Another one: assume a existing file \WINDOWS\system32\config\system

This is located at x: too, exclude x: from search

for %%i in (C D E F G H I J K L M N O P Q R S T U V W Y Z) do if exist %%i:\WINDOWS\system32\config\system set win_dir=%%i:\Windowsecho Windows folder at %win_dir%
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...