Jump to content











Photo
- - - - -

Run a batch file in bare minimum (>=1mb) 'boot.wim' ?

boot.wim 1mb smallest boot.wim

  • Please log in to reply
14 replies to this topic

#1 devdevadev

devdevadev

    Frequent Member

  • Advanced user
  • 334 posts
  •  
    India

Posted A week ago

You also need \boot\boot.sdi as it's the ramdriver that mounts the boot.wim.

Another thing is you don't necessarily need setup.exe named setup.exe. I have all (vista-8.1 both arch) OS in my
install.wim and have multiple boot wims because i'm a wim slut. Normally if you run setup.exe from an x64 boot.wim
and it has an x86 setup.exe in \sources it will have the "missing drivers" error. To get around this i run (as an example)
a renamed setup.exe in the boot.wim called w8186.exe and have the matching w8186.exe in \sources. 

My \sources looks like this. I use the sfx files for an upgrade like you mentioned.
 
2psng3a.png

Also, not very useful really, but if you boot from say \blahblahblah.wim setup will work as long as you
have a \sources\boot.wim of any size. When i say any size, i have taken a dual index regular boot.wim
and deleted EVERY file within both indexes and saved it as a 100 kb wim and setup worked.
 
In above post 'HALIKUS' stated that he had successfully run Windows Setup in a 100 KB 'boot.wim' ?
Similarly, I want to run 'UEFI.cmd' within 1mb 'boot.wim'....Is it possible ? How ?


#2 nguyentu

nguyentu

    Member

  • Members
  • 55 posts
  •  
    Vietnam

Posted A week ago

Boot.wim is a WinPE, which is the platform needed to run programs, as long as it is capable of meeting the features of that program. For example, a program called "wmic" with a ".bat" file, the platform (WinPE|boot.wim) needs to be integrated with packages like WMI ...
 
I wonder how the program can run that boot.wim only 100KB?
If this is true, I will save one to several GB.


#3 misty

misty

    Silver Member

  • Developer
  • 702 posts
  •  
    United Kingdom

Posted A week ago

In above post 'HALIKUS' stated that he had successfully run Windows Setup in a 100 KB 'boot.wim' ?
Similarly, I want to run 'UEFI.cmd' within 1mb 'boot.wim'....Is it possible ? How ?

Based on the wording of his post (in your quote), HALIKUS is not booting WinPE from the 100KB boot.wim or even running setup.exe from it - he appears to be booting from \blahblahblah.wim and the 100KB \sources\boot.wim is there merely so that setup.exe runs without error.

At least that is my take on it based on the report that he has deleted "EVERY file" from both images in \sources\boot.wim - which would also include setup.exe.

If you "...want to run 'UEFI.cmd' within 1mb 'boot.wim'..." - then you can, however you will first need to boot from something else, mount the 1mb boot.wim from the booted OS, and then run UEFI.cmd.

Misty

#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13408 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted A week ago

Technically, I believe you can use the boot.sdi directly to store the batch file however.

 

The standard one is (stupidly) large, around 3 Mb though (JFYI) at the time Joakim managed to reduce it to 900 Kb and - making a largely invalid (but still working for normal boot.wim use) NTFS filesystem to around 300 Kb:

http://www.msfn.org/...ize-of-bootsdi/

 

:duff:

Wonko



#5 devdevadev

devdevadev

    Frequent Member

  • Advanced user
  • 334 posts
  •  
    India

Posted A week ago

Technically, I believe you can use the boot.sdi directly to store the batch file however.

Can you please describe you point in detail ? I want to add a BCD entry which will just run 'UEFI.cmd' successfully. So what BCD Store should I use ? Is it must to use 'boot.wim' ? 

 

Can 'boot.sdi' not run 'UEFI.cmd' ?

 

Please give me some info about internal working of 'boot.sdi' just after bootmgr -> BCD-> boot.sdi ->> ????? 



#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13408 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted A week ago

No. :frusty:

 

The "UEFI.CMD" is a batch (actually a Windows NT batch).

 

It will ONLY run in a (at a minimum command line) Windows NT environment capable of running CMD.EXE, which is the interpreter for .cmd batch files (to be more exact UEFI.CMD may run only in XP and later, maybe on 2K, I doubt on NT :unsure:), provided that the tool it uses (mbrwizard) runs in such a reduced environment.

 

The minimal such instance of command line Windows XP is the known Dietmar's project XP in 7 mb and its derivatives (and 7 mb is the bare-bare minimum on compressed NT more realistically it will be 20-40 Mb in size, and it won't anyway boot in UEFI).

 

You CANNOT (obviously) run a batch file from an entry in a BCD, you need to boot a suitable operating system and from its command interpreter run the batch.

 

:duff:

Wonko



#7 devdevadev

devdevadev

    Frequent Member

  • Advanced user
  • 334 posts
  •  
    India

Posted A week ago

OK...I will Secure UEFI boot to Index 2 of Win 10 'boot.wim' and automatically run 'UEFI.cmd' by using 'Winpeshl.ini' method (AFAIK is the only way to automatically run a batch in WinPE environment ?).

 

But how can I reduce the size of 'boot.wim' up to bare minimum level to just capable of running 'UEFI.cmd' ? What Files/Index (or Whatever) I should remove within from 'boot.wim' ?



#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13408 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted A week ago

But how can I reduce the size of 'boot.wim' up to bare minimum level to just capable of running 'UEFI.cmd' ? What Files/Index (or Whatever) I should remove within from 'boot.wim' ?

That is essentially your problem, I doubt that until you ALREADY know if you want/need to remove Files, Indexes or Whatever you'll ever be able to reduce a boot.wim to the bare minimum, you simply miss (you just asked how to run a batch file without an OS running! :w00t: :ph34r: ) the basics, your best option is to use a project someone else (that actually knows where his/her towel is) already made, such as the excellent one by Misty:

http://mistyprojects...tyPE/index.html

http://reboot.pro/topic/18917-mistype/
http://reboot.pro/fi...ad/357-mistype/

that has been recently updated to create a MistyPE from Windows 10.

 

No idea how big a Windows 10 based MistyPE build is going to be, an old version 7 based was around 150 Mb, and though not the "most minimal possible" was already notably slimmed down).

 

As a comparison, the most reduced Windows 7 based PE boot.wim should be around 70 Mb:

http://reboot.pro/to...n7-pe-bootdisk/

 

Given that a Windows 7 "standard" boot.wim is around 150-170 Mb (x86/x64) and a Windows 10  is - if I recall correctly - around 270-300 Mb, most probably the bare minimum Windows 10 based could be around 150-200 Mb.

 

:duff:

Wonko



#9 devdevadev

devdevadev

    Frequent Member

  • Advanced user
  • 334 posts
  •  
    India

Posted A week ago

I have just open Win 10 'boot.wim' using 7-zip. There are two folders Index '1' and Index '2'. If I delete folder '2', then will it reduce size by half ?

\sources\boot.wim\1
\sources\boot.wim\2
\sources\boot.wim\[1].xml

After deleting Index:2 files, Should I edit  [1].xml file so that It will boot to Index:1 instead of Index:2 ?

 

Can I just delete following folders marked ' * ' within from Index:1 without compromising 'boot.wim' capabilities to just enable CLI function so that I can just run 'UEFI.cmd' in WinPE environment ?

 

boot.wim\1\Windows\AppCompat          *
boot.wim\1\Windows\apppatch              *
boot.wim\1\Windows\Boot                      *
boot.wim\1\Windows\Branding               *
boot.wim\1\Windows\CbsTemp              *

boot.wim\1\Windows\en-US           

boot.wim\1\Windows\Fonts                     *

boot.wim\1\Windows\Globalization         *

boot.wim\1\Windows\Help                       *

boot.wim\1\Windows\INF                         

boot.wim\1\Windows\L2Schemas            *

boot.wim\1\Windows\LiveKernelReport   *

boot.wim\1\Windows\Logs                       *

boot.wim\1\Windows\Microsoft.NET        *

boot.wim\1\Windows\PolicyDefinitions    *

boot.wim\1\Windows\Resouces

boot.wim\1\Windows\schemes                *

boot.wim\1\Windows\security                  *

boot.wim\1\Windows\servicing

boot.wim\1\Windows\system32 

boot.wim\1\Windows\Temp                       *

boot.wim\1\Windows\tracing                     *

boot.wim\1\Windows\Vss                          *

boot.wim\1\Windows\winsxs                      * 

 

Please suggest me about the folders which I should not delete within Index:1 so that 'CMD.exe' feature of 'boot.wim' just work ?

 

Regards..



#10 misty

misty

    Silver Member

  • Developer
  • 702 posts
  •  
    United Kingdom

Posted A week ago

I have just open Win 10 'boot.wim' using 7-zip. There are two folders Index '1' and Index '2'. If I delete folder '2', then will it reduce size by half ?...

Very unlikely. Please use your preferred search engine and search for "wim single instance storage".

#11 devdevadev

devdevadev

    Frequent Member

  • Advanced user
  • 334 posts
  •  
    India

Posted A week ago

Very unlikely. Please use your preferred search engine and search for "wim single instance storage".

How much smallest Win 10 PE I can expect from MistyPE just by selecting only core feature (No Program, No Drivers) so that It can just deal with batch files ?



#12 misty

misty

    Silver Member

  • Developer
  • 702 posts
  •  
    United Kingdom

Posted A week ago

How much smallest Win 10 PE I can expect from MistyPE just by selecting only core feature (No Program, No Drivers) so that It can just deal with batch files ?

Probably not small enough for what you want. MistyPE uses a boot.wim as a base/core and adds files - it doesn't delete files. By some strange quirk boot.wim may end up being smaller than the original source after the wimlib optimize command is executed, despite adding files during the build (see here).

I have no idea what your goal is and why you are so keen to trim boot.wim - you do not however appear to have a necessary understanding of the .wim format or WinPE to achieve this goal.

IF your goal is due to limited RAM, then try a flat boot WinPE with a pagefile as an alternative to RAM boot - see here

Misty

#13 misty

misty

    Silver Member

  • Developer
  • 702 posts
  •  
    United Kingdom

Posted A week ago

A quick google search resulted in something that may be of interest by Alex Verboon - Reducing size of WinPE

I haven't tried this process and have no idea if it will work.
 

1.First build your PE boot.wim the way you have been doing it so far, but before unmounting it run the following command as well: dism /image:C:\PE\mount /Enable-profiling

2.Then boot your PE and start doing all the things you will need in the future as well. Just a hint, if you intend to run the ipconfig command, you must run it now, otherwise it won’t be there anymore when you apply the profile.

3.Once you have launched all commands and done whatever you want to do, run the following command: wpeutil saveprofile e:\Optimize_Profile.txt “Image Optimization Profile”

(drive e: is a connected USB stick so that you can copy away the profile file, you will need it later).

4.Finally rebuild your PE boot.wim, with the command dism /image:C:\PEHD\mount /Apply-Profiles:c:\optimize_profile.txt and then commit the changes. Note that you do not need to run dism …../Enable Profiling again here.

The results:

* The first boot.wim was 128 MB in size, a nearly standard boot.wim with some packages added.
* The optimized boot.wim was 62 MB in size.

Happy PE shrinking !


Misty
  • devdevadev likes this

#14 Atari800XL

Atari800XL

    Member

  • Members
  • 72 posts
  •  
    Netherlands

Posted A week ago

Sounds nice, Misty, but it looks like that doesn't work anymore:

 

https://msdn.microso...nd-line-options

 

"Windows PE profiling functionality is removed beginning with Windows 8.1."



#15 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13408 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted A week ago

Yep, that in practice only applies to Windows 7 (and maybe 8) based PE's, from the mouth of the wolf:

https://technet.micr...4(v=ws.10).aspx

 

Maybe an 8 based PE (capable of UEFI booting) is possible using the DISM profiling method. :unsure:

 

Back to the good ol' manual way with Dependency Walker and (Filemon, Regmon or) Procmon :ph34r:

 

:duff:

Wonko


  • devdevadev likes this





Also tagged with one or more of these keywords: boot.wim, 1mb, smallest boot.wim

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users