Jump to content

- - - - -

Need help a little bat scripting for a new small builder

  • Please log in to reply
No replies to this topic

#1 vvurat


    Frequent Member

  • Advanced user
  • 323 posts

Posted 11 November 2023 - 12:21 PM

Hi people


I have found a new bat builder at chineese forum.




It is awesome and easy. You can build your 90mb Win10 PE in 5 seconds. I want to customize that for my needs and all of us will benefit i think :)


Download link is here: https://www.upload.e...e11pe2.rar.html


I customized it for english. For to use it put winre.wim inside program directory (index 1 of boot.wim at win10 windows setup dvd, you can export first index to winre.wim) and run WinREwim10pe11pe2.bat. Thats all.


All the builder is some little code i put at downside. I will explain how it works.


1-It exports wim file list to 1list.txt

2-It exports winsxs file list to winsxslist.txt

3-"findstr /vil" gives filenames that need exclude to from 1list.txt to 2list.txt.

(it is diffult to customize file list in here i want to customize it like need.txt that contains file list as 1list.txt but does not know how to use findstr.exe. i need help in here for to use it and command syntax. i will give a need.txt file and it will delete same rows from 2list.txt file?)

4-findstr /v  do same

5-A vbs script makes a new excel.txt from 2list.txt (puts delete commands to every line of 2list.txt nothind more)

6-wimlib makes changes and commits wim and ends.


Now what i need as customization. i want to give list of files to keep like


need.txt file contains

\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe
\Program Files\Common Files\Microsoft Shared\ink\TipRes.dll


also i want to copy files from install.wim in a copy files txt



\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe
\Program Files\Common Files\Microsoft Shared\ink\TipRes.dll


thats all. helps are wellcome. it can customizeable for all languages easly. but i do not know cmd,bat scripting so well. They are future works if i can find support.

copy Winre.wim BOOT.WIM /y
@echo off
set /a startS=%time:~6,2%
set /a startM=%time:~3,2%
echo %time%

%~dp0\wimlib extract BOOT.WIM 1 \Windows\System32\config\SYSTEM --dest-dir=add2wim --nullglob --no-acls
%~dp0\wimlib extract BOOT.WIM 1 \Windows\System32\config\software --dest-dir=add2wim --nullglob --no-acls
%~dp0\wimlib extract BOOT.WIM 1 \Windows\System32\config\DEFAULT --dest-dir=add2wim --nullglob --no-acls

reg load HKLM\pe-SYSTEM add2wim\SYSTEM
reg load HKLM\pe-SOFTWARE add2wim\SOFTWARE
reg load HKLM\pe-DEFAULT add2wim\DEFAULT

reg import add2wim\CmdLine.reg

reg unload HKLM\pe-SYSTEM
reg unload HKLM\pe-SOFTWARE
reg unload HKLM\pe-DEFAULT

%~dp0\wimlib dir winre.wim | find ".">1list.txt
%~dp0\wimlib dir winre.wim --path=windows\winsxs | find ".">winsxslist.txt

findstr /vil "r.lnk t.lnk segmono_boot.ttf segoe_slboot.ttf segoen_slboot.ttf wgl4_boot.ttf bootres.dll vga437.fon vga850.fon vga857.fon SortDefault.nls acpi.inf disk.inf errata.inf hal.inf keyboard.inf machine.inf mshdc.inf msmouse.inf usb.inf usbport.inf volume.inf notepad.exe regedit aero.msstyles aclui.dll advapi32.dll apisetschema.dll asycfilt.dll authz.dll basesrv.dll bcdboot.exe bcrypt.dll bcryptprimitives.dll winload BOOTVID.DLL cdd.dll cfgmgr32.dll cfmifs.dll ci.dll clb.dll cmd.exe cmdext.dll driver.stl combase.dll comdlg32.dll coml2.dll conhost.exe credui.dll crypt32.dll cryptbase.dll cryptdll.dll cryptsp.dll csrsrv.dll csrss.exe C_437.NLS C_850.NLS C_857.NLS C_1252.NLS C_1254.NLS C_10000.NLS C_10081.NLS devobj.dll devrtl.dll dpapi.dll dpapisrv.dll acpi.sys acpiex.sys AppleSSD.sys atapi.sys ataport.sys CEA.sys Classpnp.sys clfs.sys ClipSp.sys cmimcext.sys cng.sys condrv.sys disk.sys dxgkrnl.sys dxgmms2.sys EhStorClass.sys fastfat.sys fbwf.sys fltMgr.sys fs_rec.sys fvevol.sys hidclass.sys hidparse.sys hidusb.sys i8042prt.sys intelide.sys isapnp.sys kbdclass.sys kbdhid.sys ksecdd.sys ksecpkg.sys mouclass.sys mouhid.sys mountmgr.sys msfs.sys msisadrv.sys msrpc.sys ndis.sys netio.sys npfs.sys npsvctrig.sys ntfs.sys ntosext.sys null.sys nvstor.sys partmgr.sys pci.sys pciide.sys pciidex.sys pcw.sys pdc.sys ramdisk.sys SleepStudyHelper.sys spaceport.sys storahci.sys stornvme.sys storport.sys tm.sys Ucx01000.sys usbccgp.sys usbd.sys usbehci.sys usbhub.sys USBHUB3.SYS usbport.sys usbohci.sys USBSTOR.SYS USBXHCI.SYS usbuhci.sys vdrvroot.sys volmgr.sys volmgrx.sys volsnap.sys volume.sys watchdog.sys Wdf01000.sys WdfLdr.sys werkernel.sys wimfsf.sys wmilib.sys WppRecorder.sys BasicDisplay BasicRender drvstore.dll dui70.dll duser.dll dwmapi.dll EventAggregation.dll fltLib.dll fmifs.dll fontdrvhost.exe format.com fsutilext.dll gdi32.dll gdi32full.dll hal.dll iertutil.dll ifsutil.dll imageres.dll imagehlp.dll imm32.dll IPHLPAPI.DLL KBDTUQ.DLL KBDUS.DLL kd.dll kernel.appcore.dll kernel32.dll KernelBase.dll locale.nls lsasrv.dll lsaadt.dll lsass.exe lsm.dll l_intl.nls mpr.dll msasn1.dll msimg32.dll msprivs.dll msv1_0.dll msvcp_win.dll msvcrt.dll msxml3.dll msxml3r.dll nci.dll ncrypt.dll NetSetupApi.dll netutils.dll notepad.exe ntasn1.dll ntdll.dll ntdsapi.dll NtlmShared.dll ntmarta.dll ntoskrnl.exe ole32.dll oleacc.dll oleaccrc.dll oleaut32.dll oledlg.dll pcwum.dll powrprof.dll profapi.dll propsys.dll psapi.dll PSHED.DLL reg.exe RpcEpMap.dll rpcrt4.dll rpcss.dll rsaenh.dll rundll32.exe samsrv.dll sechost.dll secur32.dll services.exe ServicingCommon.dll setupapi.dll SHCore.dll shell32.dll shlwapi.dll smss.exe spinf.dll srvcli.dll sspicli.dll sspisrv.dll streamci.dll svchost.exe sxs.dll sxssrv.dll sysntfy.dll SystemEventsBrokerServer.dll TextShaping.dll ucrtbase.dll ufat.dll ulib.dll untfs.dll urlmon.dll user32.dll userenv.dll utcapi.dll UXInit.dll uxtheme.dll version.dll virtdisk.dll wevtapi.dll wimgapi.dll win32k.sys win32kbase.sys win32kfull.sys win32u.dll winbrand.dll wincredui.dll Windows.FileExplorer.Common.dll windows.storage.dll WindowsCodecs.dll wininet.dll wininit.exe wininitext.dll winload.efi winload.exe winlogon.exe winmm.dll winpeshl.exe winpeshl.ini winspool.drv winsrv.dll winsrvext.dll winsta.dll wintrust.dll WinTypes.dll wkscli.dll Wldap32.dll wldp.dll wpeutil.dll wpeutil.exe ws2_32.dll wsock32.dll wtsapi32.dll xmllite.dll -Core-merged Common-Drivers-merged Package-windows-Package UnifiedBPM Group-merged SXS-Runtime-Package Winpe-Dual Foundation-merged BasicDisplay BasicRender winsxs" 1list.txt>2list.txt

findstr /v ".*_microsoft.windows.c..-controls.resources_.*_en-us .*_microsoft.windows.c..-controls.resources_.*_tr-tr .*_microsoft.windows.common-controls .*_microsoft.windows.gdiplus_.*_none Manifests.*_microsoft.windows.i..utomation.proxystub Manifests.*_microsoft.windows.isolationautomation Manifests.*_microsoft.windows.systemcompatible" winsxslist.txt>>2list.txt

echo Please Wait...

Del excel.txt /f /q
Call add2wim\block.vbs
%~dp0wimlib update BOOT.WIM<excel.txt>NUL
%~dp0wimlib update BOOT.WIM<add2wim\add2wim.txt>NUL
%~dp0wimlib optimize BOOT.WIM

set /a endS=%time:~6,2%
set /a endM=%time:~3,2%
echo %time%
set /a diffS_=%endS%-%startS%
set /a diffM_=%endM%-%startM%
echo cost:%diffM_% %diffS_%

echo Finished



Edit: Chancing findstr /vil line with this line solved my problem "findstr /vil /g:need.txt 1list.txt>2list.txt"

#2 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 17 November 2023 - 12:49 PM

It depends on when/where you  use that modified line, but at first sight it seems "wrong".

> means write to file (overwriting current file)

>> means append to file (writing at the end of existing file)


the original line has:

>2list.txt in first instance


>>2list.txt in second instance

which is correct, the file is (re)created in first instance and content is appended to it in second instance.


Also (again at first sight) there should not be a real *need* of the small .vbs file, it has to be seen but its function should be possible to obtain in "pure" batch.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users