abbodi1406's Batch Scripts Repo

Discussion in 'Scripting' started by abbodi1406, May 4, 2017.

  1. Flipp3r

    Flipp3r MDL Guru

    Feb 11, 2009
    2,008
    957
    90
    Yes indeed. Missed that point in the changelog. Doh!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,209
    90,791
    340
    There are few changes in the changelog that i should document more clearly in the options section :D
     
  3. nima1024

    nima1024 MDL Member

    Sep 18, 2010
    240
    42
    10
    Thanks for clarification. :)
     
  4. thorazine74

    thorazine74 MDL Junior Member

    Sep 22, 2008
    69
    21
    0
    Is there any way to to create an iso with a previously created install.wim?
    I mean to use the script to make a install.wim, then after modding the install.wim continue the script to create the iso with the modded install.wim instead of recreating the install.wim from the UUPs?
     
  5. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    49,674
    103,513
    450
    Why not create the ISO first, modify the install.wim and replace the original install.wim with the modified one?
     
  6. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,209
    90,791
    340
  7. thorazine74

    thorazine74 MDL Junior Member

    Sep 22, 2008
    69
    21
    0
    I was doing that but I was looking for a more automated way
     
  8. thorazine74

    thorazine74 MDL Junior Member

    Sep 22, 2008
    69
    21
    0
    #1888 thorazine74, May 13, 2022
    Last edited: May 13, 2022
    Thanks but thats not what I'm after.
    I've used your uup-converter v79 with the option 2 to just create an install.wim with the UUP packs.
    I modified that install.wim and I would like to use the same uup-converter script with option 1 and create a full ISO but instead of creating a new install.wim from the UUPs packs again I wanted it to just pick the previously created install.wim and continue from there.

    I tried changing the convert-uup.cmd like this:

    Code:
    set _file=ISOFOLDER\sources\%WIMFILE%
    set _rtrn=RetISO
    
    if exist install.wim (
    echo %line%
    echo Found install.wim image on root dir, using it...
    echo Copying to the ISOFOLDER sources dir
    echo %line%
    copy install.wim ISOFOLDER\sources\install.wim
    goto :RetISO
    )
    echo %line%
    echo Creating a new install.wim...
    goto :InstallWim
    :RetISO
    if %_Debug% neq 0 if %WIMFILE%==install.esd set SkipWinRE=1
    set _rtrn=BakISO
    goto :WinreWim
    :BakISO
    and it worked but the script keeps adding a new winre.wim to the install.wim even if its already there, so I end up with a extra deleted winre.wim wasting space on install.wim.
    I tried skipping the winrewim phase but it didnt work...
    Maybe I can set SkipWinRE=1 on the second pass...
     
  9. °ツ

    °ツ MDL Addicted

    Jun 8, 2014
    903
    1,178
    30
    Hello sir, I used the SkipEdge option on Insider Preview Build 22621.1 but when installing the OS there is still Edge and I ran your script to remove it.
    Does SkipEdge option not always work?
     
  10. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    49,674
    103,513
    450
    Afaik that doesn't work for a long time now.
     
  11. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,768
    7,711
    210
    It still works, but only if
    1. Edge is already removed in the original OS, and
    2. you're installing a CU, not a new build.

    As Edge is integrated from the start in the newer Windows 10 and 11 builds, it makes sense only when updating online systems, these days.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    #1892 inTerActionVRI, May 14, 2022
    Last edited: May 14, 2022
    @abbodi1406,

    Code:
    if exist "_AppsEditions.txt" for /f "tokens=* delims=" %%# in ('type _AppsEditions.txt') do set "%%#"
    
    What would be the name of the variable to be settled in this part?


    Note only the quotation mark between yourphone and clipchamp that was moved to the end.
    from:
    Code:
    set "_appMedia=Microsoft.ZuneMusic%pub%,Microsoft.ZuneVideo%pub%,Microsoft.WindowsSoundRecorder%pub%,Microsoft.GamingApp%pub%,Microsoft.XboxGamingOverlay%pub%,Microsoft.Xbox.TCUI%pub%,Microsoft.YourPhone%pub%",Clipchamp.Clipchamp_yxz26nhyzhsrt
    
    to:
    Code:
    set "_appMedia=Microsoft.ZuneMusic%pub%,Microsoft.ZuneVideo%pub%,Microsoft.WindowsSoundRecorder%pub%,Microsoft.GamingApp%pub%,Microsoft.XboxGamingOverlay%pub%,Microsoft.Xbox.TCUI%pub%,Microsoft.YourPhone%pub%,Clipchamp.Clipchamp_yxz26nhyzhsrt"
    
    same thing with the quotation mark.
    from:
    Code:
    set "_appTeam=%_appBase%,%_appCodec%,Microsoft.MicrosoftPowerBIForWindows%pub%,microsoft.microsoftskydrive%pub%,Microsoft.MicrosoftTeamsforSurfaceHub%pub%,Microsoft.Whiteboard%pub%",Microsoft.SkypeApp_kzf8qxf38zg5c
    
    to:
    Code:
    set "_appTeam=%_appBase%,%_appCodec%,Microsoft.MicrosoftPowerBIForWindows%pub%,microsoft.microsoftskydrive%pub%,Microsoft.MicrosoftTeamsforSurfaceHub%pub%,Microsoft.Whiteboard%pub%,Microsoft.SkypeApp_kzf8qxf38zg5c"
    
     
  13. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,209
    90,791
    340
    The same one inside _AppsEditions.txt, e.g.
    Code:
    set "_appProf=Microsoft.WindowsStore_8wekyb3d8bbwe,Microsoft.StorePurchaseApp_8wekyb3d8bbwe,microsoft.windowscommunicationsapps_8wekyb3d8bbwe,Microsoft.People_8wekyb3d8bbwe,..,MicrosoftCorporationII.MicrosoftFamily_8wekyb3d8bbwe,"
    thanks for the hint about quotation marks
     
  14. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    I think I was not clear with my question earlier.
    So... Is this part, like that, correct?
    Or should be corrected for something different as:
    from:
    set "%%#"
    to:
    set "%%#=something"
    or to:
    set "something=%%#"
     
  15. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,209
    90,791
    340
    Yes
    %%# represent the whole line from _AppsEditions.txt, which already contain the variable name=value

    you can do the same with wmic.exe
    Code:
    for /f "tokens=* delims=" %%# in ('"wmic path SoftwareLicensingService Get /all /value" ^| findstr ^=') do set "%%#"
     
  16. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    I understood. I hadn't thought of it.
    Very simple and nice.
    I had also thought that perhaps it was to empty variables (like set %%#=) that were stored in this file. It's just that I didn't see the file the process was already over when I was modifying the code for my use to avoid integrating some components.

    Thnks!
     
  17. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    @abbodi1406,

    Could you add a Apps Level 4, for the launch of the next version?

    :: ### Control added Apps for Client editions (except Team) ###
    :: 0 / all referenced Apps
    :: 1 / only Store, Security Health
    :: 2 / level 1 + Photos, Camera, Notepad, Paint
    :: 3 / level 2 + Terminal, App Installer, Widgets
    :: 4 / level 1 + Terminal, App Installer, Widgets
    set AppsLevel=0

    then, from:
    Code:
    if %AppsLevel% gtr 1 (
    
    to:
    Code:
    if %AppsLevel% gtr 1 if %AppsLevel% neq 4 (
    
    If possible (If this does not break any component dependencies), I believe that only this change would already resolve.
    It was not tested. It's just a suggestion. Because I am not aware of the component dependencies from this 22563 build onwards.
     
  18. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,209
    90,791
    340
    AppsLevel is ment to be cumulative (i.e. higher level contain previous levels)

    custom AppsList would be more useful
     
  19. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    #1899 inTerActionVRI, May 15, 2022
    Last edited: May 15, 2022
    Understood.


    Yes definitely. Very cool.

    Currently in Custom Toolkit, there is a filter that reads the presence of components in each index for the removal of the components.

    So user can use their lists with older components or newer components (from Windows 11) for use on a Windows 10 build that the non -present list components are ignored.

    Menus are also managed in this way being displayed with sequentially numbered options, according to the existence of the components in the image.

    This is not the case here, because the image is being generated. So perhaps it is not possible to check the presence of components.

    In short. A universal list can be made, we users customize to our liking and, as a safety measure, can still be treated through the filters you already have structured inside the script.


    Edit: "_AppsEditions.txt" is created at :appx_sort label. How does the process prior to this work?
     
  20. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    @abbodi1406,

    I found more details regarding quotation marks in creating variables.
    There are several variable reset that are in quotation marks, but that I think is not a big problem.

    Can it be used the way below?
    set var="value"
    Or is that a typo? If it is a typo. It should it be just like that?
    set "var=value"

    If you need to check ...
    all from:
    Code:
    set ddesc="%_wtx%
    
    to:
    Code:
    set "ddesc=%_wtx%
    
    all from:
    Code:
    set cname="%_wsr%
    
    to:
    Code:
    set "cname=%_wsr%
    
    all from:
    Code:
    set dname="%_wsr%
    
    to:
    Code:
    set "dname=%_wsr%
    

    I chose to use the negative sign because it is interpreted as smaller than "0". When used letters (quoted strings) the compiler was interpreting as greater than "0", not bringing the complete referenced Apps list.

    So...
    Code:
    :: ### Control added Apps for Client editions (except Team) ###
    :: - / for _CustomAppsList.txt based on _BaseList.txt
    :: 0 / all referenced Apps
    :: 1 / only Store, Security Health
    :: 2 / level 1 + Photos, Camera, Notepad, Paint
    :: 3 / level 2 + Terminal, App Installer, Widgets
    set AppsLevel=-
    

    A contribution so we can use lists, based on my work in Custom Toolkit.
    Code:
    set _appsList=
    for %%# in (Core,CoreCountrySpecific,CoreSingleLanguage,Professional,ProfessionalEducation,ProfessionalWorkstation,Education,Enterprise,EnterpriseG,EnterpriseS,ServerRdsh,IoTEnterprise,IoTEnterpriseS,CloudEdition,CloudEditionL) do (
    if /i "%_edtn%"=="%%#" set "_appsList=%_appProf%"
    )
    for %%# in (CoreN,ProfessionalN,ProfessionalEducationN,ProfessionalWorkstationN,EducationN,EnterpriseN,EnterpriseGN,EnterpriseSN,CloudEditionN,CloudEditionLN) do (
    if /i "%_edtn%"=="%%#" set "_appsList=%_appProN%"
    )
    if /i "%_edtn%"=="PPIPro" set "_appsList=%_appTeam%"
    for %%# in (AzureStackHCICor,TurbineCor) do (
    if /i "%_edtn%"=="%%#" set "_appsList=%_appAzure%"
    )
    for %%# in (ServerStandard,ServerDatacenter,Turbine) do (
    if /i "%_edtn%"=="%%#" (if exist "%mumtarget%\Windows\Servicing\Packages\Microsoft-Windows-Server*CorEdition~*.mum" (set "_appsList=%_appSCore%") else (set "_appsList=%_appSFull%"))
    )
    echo.
    if exist "MSIXFramework\*" for /f "tokens=* delims=" %%# in ('dir /b /a:-d "MSIXFramework\*.*x"') do (
    echo %%~n#
    %_Nul1% %_dism2%:"!_cabdir!" %dismtarget% /LogPath:"%_dLog%\DismAppx.log" /Add-ProvisionedAppxPackage /PackagePath:"MSIXFramework\%%#" /SkipLicense
    )
    if defined _appsList (
       if "%AppsLevel%" equ "-" if exist "%~dp0_CustomAppsList.txt" (
           set _CustomAppsList=
           for %%a in (%_appsList%) do (set "available_%%a=1")
           for /f "eol=# tokens=*" %%c in ('type "%~dp0_CustomAppsList.txt"') do (if "!available_%%c!" equ "1" set "_CustomAppsList=!_CustomAppsList!,%%c")
           set "_appsList=!_CustomAppsList:~1!"
       )
       echo.
       echo.
       if "!_CustomAppsList!" equ "" echo.Adding Referenced Apps List . . .
       if "!_CustomAppsList!" neq "" echo.Adding Custom Apps List . . .
       echo.
       for %%# in (!_appsList!) do call :appx_add "%%#"
    )
    popd
    goto :eof
    
    :appx_add
    
    Attached a package "Lists_22621.1_convert.zip" with the base list "_BaseList.txt" and the custom test list "_CustomAppsList.txt" as an example to be used in "uup_download_windows.cmd" folder.
     

    Attached Files: