Skip to content

Instantly share code, notes, and snippets.

@AveYo
Last active August 11, 2025 04:53

Revisions

  1. AveYo revised this gist Apr 16, 2022. 2 changed files with 1 addition and 28 deletions.
    27 changes: 1 addition & 26 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -1,33 +1,10 @@
    _We did it! We broke gist.github.com_ ;) [So head over to the new home!](https://github.com/AveYo/MediaCreationTool.bat) **Thank you all!**
    **2021.10.20:** [https://github.com/AveYo/MediaCreationTool.bat](https://github.com/AveYo/MediaCreationTool.bat) now open for interaction
    - new update introducing no 11 setup checks on boot in VirtualBox

    Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
    ![Preview](https://i.imgur.com/swCwiDi.png)
    A powerful yet simple windows 10 / 11 deployment automation tool as well!

    > configure via set vars, commandline parameters or rename script like `iso 21H2 Pro MediaCreationTool.bat`
    > recommended windows setup options with the least amount of issues on upgrades set via auto.cmd
    > awesome dialogs with keyboard focus to pick target version and preset action
    > **Auto Setup** with detected media without confirmation
    > _- can troubleshoot upgrade failing by adding `no_update` to script name_
    > **Create ISO** with detected media in `C:\ESD` folder without confirmation
    > _- can override detected media by adding edition name / language / arch to script name_
    > **Create USB** with detected media after confirmation
    > _- can click Back and select ISO instead to save in a different path_
    > custom presets above support 'oem' media customization, that can be disabled by adding `no_oem` to script name
    > _- pickup `$OEM$` folder (if it exists) with any post setup tweaks like `$OEM$\$$\Setup\Scripts\setupcomplete.cmd`_
    > _- write `sources\PID.txt` file to preselect edition at media boot or setup within windows (if configured)_
    > _- write `auto.cmd` file to re-run auto setup on demand, from media (includes Skip TPM if sources are 11)_
    > _- write `winpeshl.ini` file in boot.wim to Skip TPM Check on media boot (if sources are 11)_
    > **Select in MCT** with manual confirmation for everything in MCT GUI
    > _- no 'oem' media customization, script passes products.xml configuration and quits without touching media_
    > Skip TPM Check on Dynamic Update v1 _(wmi-based)_ or v2 _(ifeo-based)_ standalone toggle scripts in `MCT\` dir
    > _- system-wide, unblocks insider previews on windows update, or running setup.exe manually while online_
    > _- when using created media on another pc for the first time, can launch `auto.cmd` from media once to enable_
    [discuss on MDL](https://forums.mydigitallife.net/forums/windows-10.54/)

    ```
    @@ -64,6 +41,4 @@ A powerful yet simple windows 10 / 11 deployment automation tool as well!
    2021.10.05: 11 22000.194 Release (rofl W11 MCT has limited capabilities, so still using 21H1 MCT because it works fine)
    2021.10.09: outstanding refactoring around Windows 11 MCT; minimize while waiting MCT; unified 7 - 11 appearence
    We broke gist.github.com ;) Script has a new home now: https://github.com/AveYo/MediaCreationTool.bat
    ```

    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_
    ```
    2 changes: 0 additions & 2 deletions .gitattributes
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    * text=auto
    * eol=crlf
  2. AveYo revised this gist Oct 20, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    _We did it! We broke gist.github.com_ ;) [So head over to the new home!](https://github.com/AveYo/MediaCreationTool.bat) **Thank you all!**
    **2021.10.20:** [https://github.com/AveYo/MediaCreationTool.bat](https://github.com/AveYo/MediaCreationTool.bat) now open for interaction
    - new update introducing no 11 setup checks on boot in VirtualBox
    _We did it! We broke gist.github.com_ ;) [So head over to the new home!](https://github.com/AveYo/MediaCreationTool.bat) **Thank you all!**
    **2021.10.20:** [https://github.com/AveYo/MediaCreationTool.bat](https://github.com/AveYo/MediaCreationTool.bat) now open for interaction
    - new update introducing no 11 setup checks on boot in VirtualBox

    Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
    ![Preview](https://i.imgur.com/swCwiDi.png)
  3. AveYo revised this gist Oct 20, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    _We did it! We broke gist.github.com_ ;) [So head over to the new home!](https://github.com/AveYo/MediaCreationTool.bat) **Thank you all!**
    **2021.10.20:** [https://github.com/AveYo/MediaCreationTool.bat](https://github.com/AveYo/MediaCreationTool.bat) now open for interaction
    - new update introducing no 11 setup checks on boot in VirtualBox

    Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
    ![Preview](https://i.imgur.com/swCwiDi.png)
  4. AveYo revised this gist Oct 9, 2021. 4 changed files with 21 additions and 1289 deletions.
    37 changes: 21 additions & 16 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,28 @@
    _We did it! We broke gist.github.com_ ;) [So head over to the new home!](https://github.com/AveYo/MediaCreationTool.bat) **Thank you all!**

    Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
    ![Preview](https://i.imgur.com/swCwiDi.png)
    A powerful yet simple windows 10 / 11 deployment automation tool as well!

    > configure via set vars, commandline parameters or rename script like `iso 21H2 Pro MediaCreationTool.bat`
    > recommended windows setup options with the least amount of issues on upgrades already set
    > awesome keyboard focus dialogs to pick windows version and enhanced preset action
    > recommended windows setup options with the least amount of issues on upgrades set via auto.cmd
    > awesome dialogs with keyboard focus to pick target version and preset action
    > **Auto Setup** for upgrading directly with the auto-detected Edition, Language, Architecture *
    > _- can troubleshoot auto setup failing by adding `no_update` to script name_
    > **Create ISO** for making iso file directly with the auto-detected Edition, Language, Architecture *
    > _- can override auto-detected by adding edition name / language / arch to script name_
    > **Create USB** for making usb after a confirmation with the auto-detected Edition, Language, Architecture *
    > with 'oem' media customization - disable by adding `no_oem` to script name
    > **Auto Setup** with detected media without confirmation
    > _- can troubleshoot upgrade failing by adding `no_update` to script name_
    > **Create ISO** with detected media in `C:\ESD` folder without confirmation
    > _- can override detected media by adding edition name / language / arch to script name_
    > **Create USB** with detected media after confirmation
    > _- can click Back and select ISO instead to save in a different path_
    > custom presets above support 'oem' media customization, that can be disabled by adding `no_oem` to script name
    > _- pickup `$OEM$` folder (if it exists) with any post setup tweaks like `$OEM$\$$\Setup\Scripts\setupcomplete.cmd`_
    > _- write `sources\PID.txt` file to preselect edition at media boot or setup within windows (if configured)_
    > _- write `auto.cmd` file to re-run auto setup on demand, from media (includes Skip TPM if 11)_
    > _- write `winpeshl.ini` file in boot.wim to Skip TPM Check on media boot (if 11)_
    > **Select in MCT** _for manually confirming everything in MCT GUI
    > without 'oem' media customization, script passes products.xml configuration and quits straightway
    > _- write `auto.cmd` file to re-run auto setup on demand, from media (includes Skip TPM if sources are 11)_
    > _- write `winpeshl.ini` file in boot.wim to Skip TPM Check on media boot (if sources are 11)_
    > **Select in MCT** with manual confirmation for everything in MCT GUI
    > _- no 'oem' media customization, script passes products.xml configuration and quits without touching media_
    > Skip TPM Check on Dynamic Update v1 _(wmi-based)_ or v2 _(ifeo-based)_ standalone toggle script for windows 11
    > Skip TPM Check on Dynamic Update v1 _(wmi-based)_ or v2 _(ifeo-based)_ standalone toggle scripts in `MCT\` dir
    > _- system-wide, unblocks insider previews on windows update, or running setup.exe manually while online_
    > _- when using created media on another pc for the first time, can launch `auto.cmd` from media once to enable_
    @@ -45,18 +48,20 @@ A powerful yet simple windows 10 / 11 deployment automation tool as well!
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    2021.08.04: done fiddling
    2021.09.03: 21H2, both 10 and 11 [unreleased]
    2021.09.25: Windows 11
    with Skip TPM Check on media boot as well as on dynamic update (standalone toggle script available)
    final touches for improved script reliability; enhanced auto upgrade preset; win 7 powershell 2.0 compatible
    2021.09.30: fix Auto Setup preset not launching.. automatically
    2021.10.04: fix for long standing tr localization quirks; Skip TPM Check v2 (ifeo-based instead of wmi)
    2021.10.05: 11 22000.194 Release (rofl W11 MCT has limited capabilities, so still using 21H1 MCT because it works fine)
    2021.10.05: 11 22000.194 Release (rofl W11 MCT has limited capabilities, so still using 21H1 MCT because it works fine)
    2021.10.09: outstanding refactoring around Windows 11 MCT; minimize while waiting MCT; unified 7 - 11 appearence
    We broke gist.github.com ;) Script has a new home now: https://github.com/AveYo/MediaCreationTool.bat
    ```

    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_
    1,219 changes: 0 additions & 1,219 deletions MediaCreationTool.bat
    0 additions, 1,219 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
    29 changes: 0 additions & 29 deletions Skip_TPM_Check_on_Dynamic_Update_v1.cmd
    Original file line number Diff line number Diff line change
    @@ -1,29 +0,0 @@
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script
    #:: v1 of the toggle script works perfectly fine for most people with a non-botched windows installation
    #:: uses a fast, fileless wmi subscription to watch for the Virtual Disk Service Loader process running during setup,
    #:: then launches a cmd erase of appraiserres.dll - that's all there is to it, no rocket science, just a great implementation
    #:: you probably don't need to have it installed at all times - just when doing feature updates or manual setup within windows
    #:: hence the on off toggle just by running the script again

    $_Paste_in_Powershell = {
    $N = 'Skip TPM Check on Dynamic Update'; $off = $false
    $0 = sp 'HKLM:\SYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $0 = ri 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe' -force -ea 0
    $0 = sc.exe config Winmgmt start= demand; sp HKLM:\SOFTWARE\Microsoft\Wbem 'Enable Costly Providers' 0 -type dword -force -ea 0
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    if ($B) { $B | rwmi; $off = $true } ; if ($C) { $C | rwmi; $off = $true } ; if ($F) { $F | rwmi; $off = $true }
    if ($off) { write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5; return }
    $P = "$([environment]::SystemDirectory)\cmd.exe"; $T = "$P /q $N (c) AveYo, 2021 /d /rerase appraiserres.dll /f /s /q"
    $D = "$($P[0]):\`$WINDOWS.~BT"; $Q = "SELECT SessionID from Win32_ProcessStartTrace WHERE ProcessName='vdsldr.exe'"
    $F = swmi -Class __EventFilter -NameSpace 'root\subscription' -args @{
    Name = $N; EventNameSpace = 'root\cimv2'; QueryLanguage = 'WQL'; Query = $Q} -PutType 2 -ea 0
    $C = swmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -args @{
    Name = $N; WorkingDirectory = $D; ExecutablePath = $P; CommandLineTemplate = $T; Priority = 128} -PutType 2 -ea 0
    $B = swmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -args @{Filter=$F;Consumer=$C} -PutType 2 -ea 0
    write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove "; timeout /t 5
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter
    #::
    25 changes: 0 additions & 25 deletions Skip_TPM_Check_on_Dynamic_Update_v2.cmd
    Original file line number Diff line number Diff line change
    @@ -1,25 +0,0 @@
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script
    #:: v2 of the toggle script comes to the aid of outliers for whom v1 did not work due to various reasons (broken/blocked/slow wmi)
    #:: uses IFEO instead to attach to the same Virtual Disk Service Loader process running during setup, then launches a cmd erase
    #:: of appraiserres.dll - but it must also do some ping-pong renaming of the exe in system32\11 - great implementation nonetheless
    #:: (for simplicity did not use powershell invoking CreateProcess and DebugActiveProcessStop to overcome IFEO constrains)
    #:: in v2 the cmd window will briefly flash while running diskmgmt - so it is not "better" per-se. just more compatible / reactive
    #:: you probably don't need to have it installed at all times - just when doing feature updates or manual setup within windows
    #:: hence the on off toggle just by running the script again

    $_Paste_in_Powershell = {
    $N = 'Skip TPM Check on Dynamic Update'
    $0 = sp 'HKLM:\SYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    if ($B) { $B | rwmi } ; if ($C) { $C | rwmi } ; if ($F) { $F | rwmi }
    $C = "cmd /q $N (c) AveYo, 2021 /d/x/r>nul (erase /f/s/q %systemdrive%\`$windows.~bt\appraiserres.dll"
    $C+= '&md 11&cd 11&ren vd.exe vdsldr.exe&robocopy "../" "./" "vdsldr.exe"&ren vdsldr.exe vd.exe&start vd -Embedding)&rem;'
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    if (test-path $K) {ri $K -force -ea 0; write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5}
    else {$0=ni $K; sp $K Debugger $C -force; write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove ";timeout /t 5}
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter
    #::
  5. AveYo revised this gist Oct 4, 2021. 2 changed files with 12 additions and 85 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -56,6 +56,7 @@ A powerful yet simple windows 10 / 11 deployment automation tool as well!
    final touches for improved script reliability; enhanced auto upgrade preset; win 7 powershell 2.0 compatible
    2021.09.30: fix Auto Setup preset not launching.. automatically
    2021.10.04: fix for long standing tr localization quirks; Skip TPM Check v2 (ifeo-based instead of wmi)
    2021.10.05: 11 22000.194 Release (rofl W11 MCT has limited capabilities, so still using 21H1 MCT because it works fine)
    ```

    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_
    96 changes: 11 additions & 85 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@
    ::# Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H2!
    ::# Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT
    ::# Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI
    ::# Changelog: 2021.10.04 fix for long standing tr localization quirks; Skip TPM Check v2
    ::# Changelog: 2021.10.05 Windows 11 Release solved tr localization quirks; Skip TPM Check v2
    ::# - improved script reliability; create iso directly; enhanced dialogs; args from script name or commandline
    ::# - 11: 22000.132+ / 21H2: 19044.1165 / 21H1: 19043.928 / 20H2: 19042.1052 / 2004: 19041.572 / 1909: 18363.1139
    ::# - 11: 22000.194 / 21H2: 19044.1165 / 21H1: 19043.928 / 20H2: 19042.1052 / 2004: 19041.572 / 1909: 18363.1139

    ::# uncomment to skip gui dialog for MCT choice: 1507 to 2109 / 11 - or rename script: "21H2 MediaCreationTool.bat"
    rem set MCT=2109
    @@ -142,10 +142,12 @@ if %MCT%0 gtr 1 if %PRE%0 lss 1 goto choice-0 = cancel
    goto choice-%MCT%

    :choice-14
    set "VER=22000" & set "VID=11" & set "CB=22000.132.210809-2349.co_release_svc_refresh" & set "CT=2021/08/" & set "CC=1.4.1"
    set "CAB=%\\%download.microsoft.com/download/f/d/d/fddbe550-0dbf-44b4-9e60-6f0e73d654c0/products_20210415.cab"
    set "VER=22000" & set "VID=11" & set "CB=22000.194.210913-1444.co_release_svc_refresh" & set "CT=2021/10/" & set "CC=1.4.1"
    set "CAB=%\\%download.microsoft.com/download/0/d/b/0db6dfde-48c9-4d70-904e-462b46d8a473/products_20211004.cab"
    set "EXE=%\\%software-download.microsoft.com/download/pr/888969d5-f34g-4e03-ac9d-1f9786c69161/MediaCreationToolW11.exe"
    rem rofl release MCT cant do upgrade or upgrade media, must use *@#& Windows11InstallationAssistant (Windows10UpgraderApp) for it
    set "EXE=%\\%download.microsoft.com/download/d/5/2/d528a4e0-03f3-452d-a98e-3e479226d166/MediaCreationTool21H1.exe"
    goto process ::# windows 11 : usability and ui downgrade, and even more ChrEdge bloat - pre-release
    goto process ::# windows 11 : usability and ui downgrade, and even more ChrEdge bloat - release

    :choice-13
    set "VER=19044" & set "VID=21H2" & set "CB=19044.1165.210806-1742.21h2_release_svc_refresh" & set "CT=2021/09/" & set "CC=1.4.1"
    @@ -388,7 +390,7 @@ powershell -win 0 -nop -c ";"
    set "LABEL=%XI% %VIS%" & for %%s in (%EDITION% %LANGCODE% %ARCH%) do call set "LABEL=%%LABEL%% %%s"
    call :DIR2ISO "%SystemDrive%\ESD\Windows" "%ROOT%\%LABEL%.iso" "%CB%"
    if not errorlevel 1 rd /s/q "%SystemDrive%\ESD\Windows" 2>nul
    timeout /t 3 >nul
    timeout /t 5 >nul

    ::###############
    EXIT/B ALL DONE
    @@ -439,8 +441,8 @@ EXIT/B ALL DONE
    $C = "cmd /q $N (c) AveYo, 2021 /d/x/r>nul (erase /f/s/q %systemdrive%\`$windows.~bt\appraiserres.dll"
    $C+= '&md 11&cd 11&ren vd.exe vdsldr.exe&robocopy "../" "./" "vdsldr.exe"&ren vdsldr.exe vd.exe&start vd -Embedding)&rem;'
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    $0 = ni $K; sp $K Debugger $C -force
    $0 = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $0 = ni $K -force -ea 0; sp $K Debugger $C -force
    $0 = sp 'HKLM:\SYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    }
    #:: MCT custom preset processing
    switch ($PRESET) {
    @@ -713,7 +715,7 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    }
    }}
    $lines = ([io.file]::ReadAllText($env:0)-split':PS_INSERT_BUSINESS_CSV\:')[1]; $insert = $false
    if ($null -ne $lines -and $env:INSERT_BUSINESS -ge 1 -and 22000,19044,19042,19041,18363,15063,14393 -contains $ver) {
    if ($null -ne $lines -and $env:INSERT_BUSINESS -ge 1 -and 19044,19042,19041,18363,15063,14393 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') | & { process { if ($_.Ver -eq $ver) {$_} } }
    $edi = @{ent='Enterprise';enN='EnterpriseN';edu='Education';edN='EducationN';clo='Cloud';clN='CloudN';
    pro='Professional';prN='ProfessionalN'}
    @@ -1215,79 +1217,3 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    ::#,19044,vol,uk-ua,3560300978,2560869654,ef8b3d474e7ad1e17af42944e24dcd959d9827a2,5023d2cd938ff1546f7f8c392cb1b42ddd94b0cf,c,d
    ::#,19044,vol,zh-cn,3803796929,2805393938,d262ad930f0f5554a061d2cb77ce3d305a3a65c0,d26a5e87bb96535b3704d671c69aab338925f2e1,d,c
    ::#,19044,vol,zh-tw,3780899927,2785302702,f941f292e144189917ace0a03ada3002940c2232,ef2887d062fa12cf23fee5a5570f329e7969ad5d,d,d
    ::#,22000,ret,ar-sa,3583316326,,410af1a315b5649257cf00556adec8a4d4819cf7,,c,
    ::#,22000,ret,bg-bg,3629687844,,f1b9c5a8925f73de0505bf371ffbfdc8fd81b482,,c,
    ::#,22000,ret,cs-cz,3624659767,,86a4d9e7b149bd6f6eb824b2202eca42b1e68044,,d,
    ::#,22000,ret,da-dk,3647296779,,4b94e3fc47b0fe708b5da74ed6e844f933a3d226,,d,
    ::#,22000,ret,de-de,3752132208,,d074866ec32c441788502f31a963ae6d223cb1fe,,d,
    ::#,22000,ret,el-gr,3647287583,,863653f797a876db08a487aba53cc271658eccf5,,d,
    ::#,22000,ret,en-gb,3735644945,,5f9570231f4f557cdb9cbd6d63b7e9b722496681,,d,
    ::#,22000,ret,en-us,3748914969,,966cbea0f8a06f27f64658a5db8a9f0dd43c77ed,,d,
    ::#,22000,ret,es-es,3747642346,,93db217252f3b79e8bdd890339c9c70e2002e6e0,,d,
    ::#,22000,ret,es-mx,3589906878,,6f47fcca6729e8023452094f350dcc284f9d477a,,d,
    ::#,22000,ret,et-ee,3602211257,,063a5554c2becfc00973ea8cbe7099df69a85c8c,,d,
    ::#,22000,ret,fi-fi,3627682542,,1737eb05ac40ac7967fab77c88640794687349f6,,d,
    ::#,22000,ret,fr-ca,3589489013,,003e57f00ef926be0d975d6d70941c1862ebdb4f,,d,
    ::#,22000,ret,fr-fr,3754850063,,886c1ca6f217b8cf583d55b3c34a782ac4f88afe,,d,
    ::#,22000,ret,he-il,3546086225,,7c40bc5884fc1c745ebc5053e3fc6edd027ef44c,,d,
    ::#,22000,ret,hr-hr,3605046277,,8bb0f9acb6d75503f74ac196cad3f5b12907de31,,d,
    ::#,22000,ret,hu-hu,3620481836,,4fad05b8b23dbc403c3583717637966318c48b3d,,d,
    ::#,22000,ret,it-it,3675137777,,034f05fb81a15e857374cc51466d0db9b831b93d,,d,
    ::#,22000,ret,ja-jp,3732753328,,f1b0b7c82ece337fa3836c339eff203d603a1144,,d,
    ::#,22000,ret,ko-kr,3572585818,,0a9443823e621fb77ab827def4054d0e5ec53d01,,c,
    ::#,22000,ret,lt-lt,3600000489,,2b5165c439c152831376ddc297e2dd10aa732f81,,d,
    ::#,22000,ret,lv-lv,3599419874,,e8df278adb9c258bfaa6986a869285c8e7c367e6,,d,
    ::#,22000,ret,nb-no,3618910283,,0f73f893ca517d153929fa9be02453339a4833a4,,d,
    ::#,22000,ret,nl-nl,3624341483,,01d9a99993f448b4e826a960f5a82164a3f6316c,,c,
    ::#,22000,ret,pl-pl,3644350929,,a1f7e88f602ae2d450c4459da26ed8aadf401e87,,c,
    ::#,22000,ret,pt-br,3589692090,,fbc2a853deaea7e6df538634b5c420b23f5ebd75,,d,
    ::#,22000,ret,pt-pt,3669988808,,50f7dc90167c434c2a03fa405aa45f2e250f60fc,,c,
    ::#,22000,ret,ro-ro,3607667567,,c6248ac88b149aa2ba265cab7b680486bd5df490,,d,
    ::#,22000,ret,ru-ru,3589442540,,f92975ad1887ec325e768c244cfa347ef8c80a85,,d,
    ::#,22000,ret,sk-sk,3610453257,,de07775aa09586485f6fca1ceaf0cd2dcee1b8c0,,c,
    ::#,22000,ret,sl-si,3605518791,,db8a61d1f228e646d6d77513a2289482605d7fd1,,d,
    ::#,22000,ret,sr-rs,3516947635,,8c788c2becb01cb61705b2d3b08ac41903248df9,,c,
    ::#,22000,ret,sv-se,3627750740,,0449e60ca2ffb0c711f1c1846783e9d01f5c7a42,,d,
    ::#,22000,ret,th-th,3535448206,,ffd63b826628dc4e3f8b925be1c1f6c1bd4e90b1,,d,
    ::#,22000,ret,tr-tr,3528193108,,7b17cd645ce262e91aba22887a3dabe204e5242b,,c,
    ::#,22000,ret,uk-ua,3526629873,,1e6be24945e6d16453c990ad2efa9001ee0215a3,,d,
    ::#,22000,ret,zh-cn,3809043357,,c2688015d7416d37884cbc44651b93b00d874850,,c,
    ::#,22000,ret,zh-tw,3740408094,,9453708f66b61f35c3810e7921a4684ad00e4e85,,d,
    ::#,22000,vol,ar-sa,3508136521,,b655af232485ce60c4f6e6d2bf398e77f1d37d80,,c,
    ::#,22000,vol,bg-bg,3557807393,,da4a41723c6e4fb84fdc454e5c6e371416c26d6a,,c,
    ::#,22000,vol,cs-cz,3557663913,,b5907351c4aa789e04f6463f72588c9fb3725527,,c,
    ::#,22000,vol,da-dk,3566444875,,d2d862c94b29ac362b31fbddfc4ed4529b651b07,,c,
    ::#,22000,vol,de-de,3684037623,,355855d095926993ed378d5dba4f708bd8097f07,,c,
    ::#,22000,vol,el-gr,3560501265,,6bd63125788d60c99991a117ebb01f2c646e55b1,,c,
    ::#,22000,vol,en-gb,3641285707,,014131bf8cc7c5aceddfe2fd08f75bcc093fb6e3,,c,
    ::#,22000,vol,en-us,3644121998,,77349bdc0c6e4968db60b678c8dba2cd34530678,,c,
    ::#,22000,vol,es-es,3652812219,,4f7870e288c7b856d4499a9a898966a2187e8297,,c,
    ::#,22000,vol,es-mx,3497191326,,7e276e251f329a4e59535a962954fca46d186526,,c,
    ::#,22000,vol,et-ee,3522209675,,b2c00af3261dde51c82ce32f4cdf974d35863141,,d,
    ::#,22000,vol,fi-fi,3552932610,,d1e9bbdaaa90e5c19d8b98b116e465bbe63ae295,,d,
    ::#,22000,vol,fr-ca,3532729342,,1960f99b222863c581736f5757b799bde7dbeefc,,d,
    ::#,22000,vol,fr-fr,3642623614,,3cb99ef08d1c8b43b257f304f2789fa907382f75,,d,
    ::#,22000,vol,he-il,3496759455,,967f23f4159073e96352c9c8e75e8109f6891ce8,,d,
    ::#,22000,vol,hr-hr,3531052162,,5b9c3df41e7db46f9bfa5ece06c64ee34d8bdc80,,d,
    ::#,22000,vol,hu-hu,3549040526,,0f9853ef3e04bfa1edcbc9731685df04b223e728,,c,
    ::#,22000,vol,it-it,3601047615,,97fffb3c4f061ae94edcbc644ace1549d4cb0cec,,d,
    ::#,22000,vol,ja-jp,3684020489,,87280ecc92ec8975a197d3a96a2fe7454c6d75a3,,d,
    ::#,22000,vol,ko-kr,3514624025,,184f0265da295ff676755a7912e3e5f84dd58254,,d,
    ::#,22000,vol,lt-lt,3524164558,,0920086a6072ab18b89d41e32619dfa0b43e4d3f,,c,
    ::#,22000,vol,lv-lv,3524469208,,738f7e6eabccc71df22549d9ab585bf3c996f73a,,c,
    ::#,22000,vol,nb-no,3552213730,,07be42354c0c8e77361b2269cf18f820e7fbb017,,c,
    ::#,22000,vol,nl-nl,3550728565,,074bac75e804cb8c12bc82fb95c0636713ab0de0,,c,
    ::#,22000,vol,pl-pl,3575760052,,8a8b41dbc1eb66be8a9bc35cea46f350c73d602d,,c,
    ::#,22000,vol,pt-br,3500041130,,c5269deace016b37fd7a480b56f4a646f56100b9,,c,
    ::#,22000,vol,pt-pt,3570573190,,204ded9b4f1eac1a026177f4a0ef8bd75433539e,,c,
    ::#,22000,vol,ro-ro,3525902250,,16ba6e32afdc4734b7c6be8b7d5c70bb641d476c,,c,
    ::#,22000,vol,ru-ru,3500954654,,77100a848e8431fdbcafc92ddf2978ac2d9ca11c,,c,
    ::#,22000,vol,sk-sk,3542127077,,f4a7a11b99e02737e5d590a6927974cd02fd0368,,c,
    ::#,22000,vol,sl-si,3538541123,,968581fe408abcd8e8cafb28c2dbd5ab3e56bc3f,,c,
    ::#,22000,vol,sr-rs,3428059804,,2a5ffba0b12dc6ffd1e28003f5eb0e44fa8eb049,,d,
    ::#,22000,vol,sv-se,3551100059,,2be4f0940bfe32642c23dc1c6282e8ba91944dd8,,c,
    ::#,22000,vol,th-th,3448877500,,ef11113706b4ddc1368b25b928a7b2bc8f8f8010,,c,
    ::#,22000,vol,tr-tr,3447762877,,0eea822185c20767fd5ad40a3367a1156ce1f422,,c,
    ::#,22000,vol,uk-ua,3453971472,,d1b457622d20ca3edd9708e126881a7d78246d74,,c,
    ::#,22000,vol,zh-cn,3723366348,,923f912bdfd9374d9890fea8e0fa76a57d3db524,,c,
    ::#,22000,vol,zh-tw,3683258981,,d3bd7de86e3ab27a57910faf919f240c35aca807,,d,
  6. AveYo revised this gist Oct 4, 2021. 4 changed files with 62 additions and 18 deletions.
    34 changes: 21 additions & 13 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,27 @@
    Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
    ![Preview](https://i.imgur.com/swCwiDi.png)
    A powerful yet simple windows 1X deployment automation tool as well!
    A powerful yet simple windows 10 / 11 deployment automation tool as well!

    > awesome gui dialogs to pick windows version and preset action
    > **Auto Setup** choice for upgrade directly without prompts, with edition change / intelligent fallback
    > **Create ISO** choice for authoring iso file directly via DIR2ISO snippet, including any 'oem' customization
    > **Create USB** choice for authoring usb via native MCT, including any 'oem' customization (prompts once)
    > **Select in MCT** choice for vanilla MCT processing without 'oem' customization, script quits straightway
    > control via set script vars, commandline parameters or rename script like `iso 21H2 Pro MediaCreationTool.bat`
    > set recommended windows setup options that give the least amount of issues when doing upgrades
    > pickup `$OEM$` folder with post setup tweaks like `$OEM$\$$\Setup\Scripts\` `setupcomplete.cmd` or `OOBE.cmd`
    > write `sources\PID.txt` file to preselect edition at media boot or windows setup
    > write `auto.cmd` file to run auto setup without prompts from media, on demand
    > 11: Skip TPM Check on media boot via winpeshl.ini file (cleaner than altering system hive directly)
    > 11: Skip TPM Check on dynamic update v2 - system-wide (works for insider preview), also as standalone toggle script
    > configure via set vars, commandline parameters or rename script like `iso 21H2 Pro MediaCreationTool.bat`
    > recommended windows setup options with the least amount of issues on upgrades already set
    > awesome keyboard focus dialogs to pick windows version and enhanced preset action
    > **Auto Setup** for upgrading directly with the auto-detected Edition, Language, Architecture *
    > _- can troubleshoot auto setup failing by adding `no_update` to script name_
    > **Create ISO** for making iso file directly with the auto-detected Edition, Language, Architecture *
    > _- can override auto-detected by adding edition name / language / arch to script name_
    > **Create USB** for making usb after a confirmation with the auto-detected Edition, Language, Architecture *
    > with 'oem' media customization - disable by adding `no_oem` to script name
    > _- pickup `$OEM$` folder (if it exists) with any post setup tweaks like `$OEM$\$$\Setup\Scripts\setupcomplete.cmd`_
    > _- write `sources\PID.txt` file to preselect edition at media boot or setup within windows (if configured)_
    > _- write `auto.cmd` file to re-run auto setup on demand, from media (includes Skip TPM if 11)_
    > _- write `winpeshl.ini` file in boot.wim to Skip TPM Check on media boot (if 11)_
    > **Select in MCT** _for manually confirming everything in MCT GUI
    > without 'oem' media customization, script passes products.xml configuration and quits straightway
    > Skip TPM Check on Dynamic Update v1 _(wmi-based)_ or v2 _(ifeo-based)_ standalone toggle script for windows 11
    > _- system-wide, unblocks insider previews on windows update, or running setup.exe manually while online_
    > _- when using created media on another pc for the first time, can launch `auto.cmd` from media once to enable_
    [discuss on MDL](https://forums.mydigitallife.net/forums/windows-10.54/)

    5 changes: 3 additions & 2 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -100,9 +100,9 @@ for %%/ in (%~n0 %*) do set ".=%%~/" & for /f %%C in ('cmd/q/v:on/recho;!.:~2^,1
    for %%/ in (%~n0 %*) do for %%A in (x86 x64) do if /i %%/ equ %%A set "ARCH=%%A"

    ::# parse KEY from script name or commandline - accepts the format: AAAAA-VVVVV-EEEEE-YYYYY-OOOOO
    for %%/ in (%KEY% %~n0 %*) do for /f "tokens=1-5 delims=-" %%a in ("%%/") do if "%%e" neq "" set "PKEY=%%/"
    for %%/ in (%KEY% %~n0 %*) do for /f "tokens=1-5 delims=-" %%a in ("%%/") do if "%%e" neq "" set "PKEY=%%/" & set "KEY="
    if defined PKEY set "PKEY1=%PKEY:~-1%" & set "PKEY28=%PKEY:~28,1%"
    if defined EDITION if "%PKEY1%" equ "%PKEY28%" set "KEY=%PKEY%"
    if defined EDITION if "%PKEY1%" equ "%PKEY28%" (set "KEY=%PKEY%") else set "PKEY="

    ::# parse NO_UPDATE from script name or commandline - dont download and apply latest LCU on upgrade [more C: space and might fail]
    for %%/ in (%~n0 %*) do if /i %%/ equ no_update set "NO_UPDATE=1"
    @@ -370,6 +370,7 @@ set ACTION=%ACTION% /Pkey Defer& set OPTIONS=%OPTIONS% %UPDATE% %UNDO% /SkipSumm
    ::# generate PID.txt to preset EDITION on boot media - MCT install.esd indexes only, ProWS/ProEdu only via auto.cmd
    if defined KEY set AUTO_KEY=/Pkey %KEY%
    for %%/ in (Workstation WorkstationN Education EducationN) do if "Professional%%/" equ "%EDITION%" set "KEY="
    if not defined PKEY if "Enterprise" equ "%EDITION%" set "KEY=" &rem explicitly remove generic PID.txt for Enterprise
    if not defined KEY (del /f /q PID.txt 2>nul) else (echo;[PID]& echo;Value=%KEY%& echo;;Edition=%EDITION%)>PID.txt

    ::# generate auxiliary script files
    29 changes: 29 additions & 0 deletions Skip_TPM_Check_on_Dynamic_Update_v1.cmd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script
    #:: v1 of the toggle script works perfectly fine for most people with a non-botched windows installation
    #:: uses a fast, fileless wmi subscription to watch for the Virtual Disk Service Loader process running during setup,
    #:: then launches a cmd erase of appraiserres.dll - that's all there is to it, no rocket science, just a great implementation
    #:: you probably don't need to have it installed at all times - just when doing feature updates or manual setup within windows
    #:: hence the on off toggle just by running the script again

    $_Paste_in_Powershell = {
    $N = 'Skip TPM Check on Dynamic Update'; $off = $false
    $0 = sp 'HKLM:\SYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $0 = ri 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe' -force -ea 0
    $0 = sc.exe config Winmgmt start= demand; sp HKLM:\SOFTWARE\Microsoft\Wbem 'Enable Costly Providers' 0 -type dword -force -ea 0
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    if ($B) { $B | rwmi; $off = $true } ; if ($C) { $C | rwmi; $off = $true } ; if ($F) { $F | rwmi; $off = $true }
    if ($off) { write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5; return }
    $P = "$([environment]::SystemDirectory)\cmd.exe"; $T = "$P /q $N (c) AveYo, 2021 /d /rerase appraiserres.dll /f /s /q"
    $D = "$($P[0]):\`$WINDOWS.~BT"; $Q = "SELECT SessionID from Win32_ProcessStartTrace WHERE ProcessName='vdsldr.exe'"
    $F = swmi -Class __EventFilter -NameSpace 'root\subscription' -args @{
    Name = $N; EventNameSpace = 'root\cimv2'; QueryLanguage = 'WQL'; Query = $Q} -PutType 2 -ea 0
    $C = swmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -args @{
    Name = $N; WorkingDirectory = $D; ExecutablePath = $P; CommandLineTemplate = $T; Priority = 128} -PutType 2 -ea 0
    $B = swmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -args @{Filter=$F;Consumer=$C} -PutType 2 -ea 0
    write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove "; timeout /t 5
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter
    #::
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,16 @@
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script
    #:: v2 using ifeo instead of wmi - increased compatibility at the cost of showing a cmd briefly on diskmgmt
    #:: v2 of the toggle script comes to the aid of outliers for whom v1 did not work due to various reasons (broken/blocked/slow wmi)
    #:: uses IFEO instead to attach to the same Virtual Disk Service Loader process running during setup, then launches a cmd erase
    #:: of appraiserres.dll - but it must also do some ping-pong renaming of the exe in system32\11 - great implementation nonetheless
    #:: (for simplicity did not use powershell invoking CreateProcess and DebugActiveProcessStop to overcome IFEO constrains)
    #:: in v2 the cmd window will briefly flash while running diskmgmt - so it is not "better" per-se. just more compatible / reactive
    #:: you probably don't need to have it installed at all times - just when doing feature updates or manual setup within windows
    #:: hence the on off toggle just by running the script again

    $_Paste_in_Powershell = {
    $N = 'Skip TPM Check on Dynamic Update'
    $0 = sp 'HKLM:\SYSTEM\Setup\MoSetup' 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    @@ -13,7 +20,6 @@ $_Paste_in_Powershell = {
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    if (test-path $K) {ri $K -force -ea 0; write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5}
    else {$0=ni $K; sp $K Debugger $C -force; write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove ";timeout /t 5}
    $0 = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter
    #,#
    #::
  7. AveYo revised this gist Oct 4, 2021. 3 changed files with 74 additions and 64 deletions.
    9 changes: 5 additions & 4 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -4,16 +4,16 @@ A powerful yet simple windows 1X deployment automation tool as well!

    > awesome gui dialogs to pick windows version and preset action
    > **Auto Setup** choice for upgrade directly without prompts, with edition change / intelligent fallback
    > **Create ISO** choice for authoring iso file directly via DIR2ISO snippet, including any 'oem' customizations
    > **Create USB** choice for authoring usb via native MCT, including any 'oem' customizations (prompts once)
    > **Select in MCT** choice for vanilla MCT processing without 'oem' modifications, script quits straightway
    > **Create ISO** choice for authoring iso file directly via DIR2ISO snippet, including any 'oem' customization
    > **Create USB** choice for authoring usb via native MCT, including any 'oem' customization (prompts once)
    > **Select in MCT** choice for vanilla MCT processing without 'oem' customization, script quits straightway
    > control via set script vars, commandline parameters or rename script like `iso 21H2 Pro MediaCreationTool.bat`
    > set recommended windows setup options that give the least amount of issues when doing upgrades
    > pickup `$OEM$` folder with post setup tweaks like `$OEM$\$$\Setup\Scripts\` `setupcomplete.cmd` or `OOBE.cmd`
    > write `sources\PID.txt` file to preselect edition at media boot or windows setup
    > write `auto.cmd` file to run auto setup without prompts from media, on demand
    > 11: Skip TPM Check on media boot via winpeshl.ini file (cleaner than altering system hive directly)
    > 11: Skip TPM Check on dynamic update - system-wide (works for insider previews), also as standalone toggle script
    > 11: Skip TPM Check on dynamic update v2 - system-wide (works for insider preview), also as standalone toggle script
    [discuss on MDL](https://forums.mydigitallife.net/forums/windows-10.54/)

    @@ -47,6 +47,7 @@ A powerful yet simple windows 1X deployment automation tool as well!
    with Skip TPM Check on media boot as well as on dynamic update (standalone toggle script available)
    final touches for improved script reliability; enhanced auto upgrade preset; win 7 powershell 2.0 compatible
    2021.09.30: fix Auto Setup preset not launching.. automatically
    2021.10.04: fix for long standing tr localization quirks; Skip TPM Check v2 (ifeo-based instead of wmi)
    ```

    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_
    103 changes: 58 additions & 45 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@
    ::# Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H2!
    ::# Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT
    ::# Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI
    ::# Changelog: 2021.09.25 Windows 11 ; 2021.09.30 fix Auto Setup preset not launching
    ::# Changelog: 2021.10.04 fix for long standing tr localization quirks; Skip TPM Check v2
    ::# - improved script reliability; create iso directly; enhanced dialogs; args from script name or commandline
    ::# - 11: 22000.132 / 21H2: 19044.1165 / 21H1: 19043.928 / 20H2: 19042.1052 / 2004: 19041.572 / 1909: 18363.1139
    ::# - 11: 22000.132+ / 21H2: 19044.1165 / 21H1: 19043.928 / 20H2: 19042.1052 / 2004: 19041.572 / 1909: 18363.1139

    ::# uncomment to skip gui dialog for MCT choice: 1507 to 2109 / 11 - or rename script: "21H2 MediaCreationTool.bat"
    rem set MCT=2109
    @@ -50,7 +50,7 @@ set/a INSERT_BUSINESS=1

    ::# MCT Version choice dialog items and default-index
    set VERSIONS=1507,1511,1607,1703,1709,1803,1809,1903,1909,20H1,20H2,21H1,21H2,11
    set dV=13
    set dV=14

    ::# MCT Preset choice dialog items and default-index
    set PRESETS=Auto Setup,Create ISO,Create USB,Select in MCT
    @@ -89,7 +89,7 @@ if defined ISO if not defined AUTO set/a PRE=2 & if defined MCT set/a CREATE=1
    ::# parse EDITION from script name or commandline - accept one of the staged editions in MCT install.esd - see sources\product.ini
    set _=%EDITION% %~n0 %* & rem ::# also accepts the alternative names: Home, HomeN, Pro, ProN, Edu, EduN
    for %%/ in (%_:Home=Core% %_:Pro =Professional % %_:ProN=ProfessionalN% %_:Edu =Education % %_:EduN=EducationN%) do (
    for %%E in ( ProfessionalEducation ProfessionalEducationN ProfessionalWorkstation ProfessionalWorkstationN
    for %%E in ( ProfessionalEducation ProfessionalEducationN ProfessionalWorkstation ProfessionalWorkstationN Cloud CloudN
    Core CoreN CoreSingleLanguage CoreCountrySpecific Professional ProfessionalN Education EducationN Enterprise EnterpriseN
    ) do if /i %%/ equ %%E set "EDITION=%%E")

    @@ -242,7 +242,7 @@ goto process ::# fastest for potato PCs
    %<%:0c " CANCELED "%>% & timeout /t 3 >nul & EXIT/B

    :start
    @title %~nx0& color 1f& mode 120,30& echo off& set "ROOT=%~dp0"& set "0=%~f0"& set "__COMPAT_LAYER=Installer"
    @title %~nx0& mode 120,30& color 1f& echo off& set "ROOT=%~dp0"& set "0=%~f0"& set "__COMPAT_LAYER=Installer"
    ::# self-echo top 1-20 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,19) do set \=& set/p \=& call echo;%%\%%)
    ::# lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    @@ -285,10 +285,12 @@ if %VER% leq 16299 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Educa
    if %VER% leq 10586 (set MEDIA_EDITION=%MEDIA_EDITION:Enterprise=Professional%)
    if %VER% leq 15063 if %INSERT_BUSINESS%0 lss 1 (set MEDIA_EDITION=%MEDIA_EDITION:Enterprise=Professional%)
    if %VER% leq 10586 if %UNHIDE_BUSINESS%0 lss 1 (set MEDIA_EDITION=%MEDIA_EDITION:Education=Professional%)
    if %VER% neq 15063 (set MEDIA_EDITION=%MEDIA_EDITION:Cloud=Professional%)
    if not defined EDITION if "%MEDIA_EDITION%" neq "%OS_EDITION%" set "EDITION=%MEDIA_EDITION%"

    ::# generic key preset - only for staged editions in MCT install.esd - see sources\product.ini
    for %%/ in (%MEDIA_EDITION%) do for %%K in (
    V3WVW-N2PV2-CGWC3-34QGF-VMJ2C.Cloud NH9J3-68WK7-6FB93-4K3DF-DJ4F6.CloudN
    YTMG3-N6DKC-DKB77-7M9GH-8HVX7.Core 4CPRK-NM3K3-X6XXQ-RXX86-WXCHW.CoreN
    BT79Q-G7N6G-PGBYW-4YWX6-6F4BT.CoreSingleLanguage N2434-X9D7W-8PF6X-8DV9T-8TYMD.CoreCountrySpecific
    VK7JG-NPHTM-C97JM-9MPGT-3V66T.Professional 2B87N-8KFHP-DKV6R-Y2C8J-PKCKT.ProfessionalN
    @@ -431,8 +433,14 @@ EXIT/B ALL DONE
    }
    popd
    }
    #:: Skip TPM Check on Dynamic Update for 11 - just read it from standalone toggle file to not duplicate code here
    if ($11) {$env:skip_tpm_enabled=1; iex ([io.file]::ReadAllText("$pwd\Skip_TPM_Check_on_Dynamic_Update.cmd")-split'\$\:code;')[1]}
    #:: Skip TPM Check on Dynamic Update v2 - also available as standalone toggle script in the MCT subfolder
    if ($11) {
    $C = "cmd /q $N (c) AveYo, 2021 /d/x/r>nul (erase /f/s/q %systemdrive%\`$windows.~bt\appraiserres.dll"
    $C+= '&md 11&cd 11&ren vd.exe vdsldr.exe&robocopy "../" "./" "vdsldr.exe"&ren vdsldr.exe vd.exe&start vd -Embedding)&rem;'
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    $0 = ni $K; sp $K Debugger $C -force
    $0 = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    }
    #:: MCT custom preset processing
    switch ($PRESET) {
    'Auto Setup' {
    @@ -471,6 +479,7 @@ EXIT/B ALL DONE
    }
    #:: undo workaround for version 1703 and earlier not having media selection switches
    MCTCompatUndo
    #,#
    '@; [io.file]::WriteAllText('custom_preset.ps1', $text)
    :generate_custom_preset_ps1
    ::------------------------------------------------------------------------------------------------------------------------------::
    @@ -499,6 +508,7 @@ for /f "tokens=2*" %%R in ('reg query %NT% /v CurrentBuildNumber /reg:64 2^>nul'
    ::# media selection from PID.txt - get it verbosely in case auto.cmd is reused without MediaCreationTool.bat
    set Value=& set Edition=& if exist PID.txt for /f "delims=" %%v in (PID.txt) do (set %%v)2>nul
    if defined Value for %%K in (
    Cloud.V3WVW-N2PV2-CGWC3-34QGF-VMJ2C CloudN.NH9J3-68WK7-6FB93-4K3DF-DJ4F6
    Core.YTMG3-N6DKC-DKB77-7M9GH-8HVX7 CoreN.4CPRK-NM3K3-X6XXQ-RXX86-WXCHW
    CoreSingleLanguage.BT79Q-G7N6G-PGBYW-4YWX6-6F4BT CoreCountrySpecific.N2434-X9D7W-8PF6X-8DV9T-8TYMD
    Professional.VK7JG-NPHTM-C97JM-9MPGT-3V66T ProfessionalN.2B87N-8KFHP-DKV6R-Y2C8J-PKCKT
    @@ -541,35 +551,37 @@ set NT="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    :skip_tpm_check_on_dynamic_update - also available as standalone toggle script in the MCT subfolder
    set "0=%~f0"& powershell -nop -c "iex ([io.file]::ReadAllText($env:0)-split'skip\:tpm.*')[1];" &exit/b skip:tpm
    $S = gi -force 'setupprep.exe' -ea 0; if ($S.VersionInfo.FileBuildPart -lt 22000) {return} #:: abort if not 11 media
    $C = "cmd /q $N (c) AveYo, 2021 /d/x/r>nul (erase /f/s/q %systemdrive%\`$windows.~bt\appraiserres.dll"
    $C+= '&md 11&cd 11&ren vd.exe vdsldr.exe&robocopy "../" "./" "vdsldr.exe"&ren vdsldr.exe vd.exe&start vd -Embedding)&rem;'
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    $0 = ni $K; sp $K Debugger $C -force
    $0 = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    #,#
    '@; [io.file]::WriteAllText('auto.cmd', $text)
    :generate_auto_cmd
    ::------------------------------------------------------------------------------------------------------------------------------::

    :generate_Skip_TPM_Check_on_Dynamic_Update_cmd $text = @'
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script
    #:: v2 using ifeo instead of wmi - increased compatibility at the cost of showing a cmd briefly on diskmgmt

    $_Paste_in_Powershell = { $:code;
    $N = 'Skip TPM Check on Dynamic Update'; $toggle = $null -eq $env:skip_tpm_enabled; $off = $false
    $M = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $M = sc.exe config Winmgmt start= demand; sp HKLM:\SOFTWARE\Microsoft\Wbem 'Enable Costly Providers' 0 -type dword -force -ea 0
    $_Paste_in_Powershell = {
    $N = 'Skip TPM Check on Dynamic Update'
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    if ($B -or $C -or $F) { $B | rwmi; $C | rwmi; $F | rwmi; $off = $true }
    if ($toggle -and $off) { write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5; return }
    $P = "$([environment]::SystemDirectory)\cmd.exe"; $T = "$P /q $N (c) AveYo, 2021 /d /rerase appraiserres.dll /f /s /q"
    $D = "$($P[0]):\`$WINDOWS.~BT"; $Q = "SELECT SessionID from Win32_ProcessStartTrace WHERE ProcessName='vdsldr.exe'"
    $F = swmi -Class __EventFilter -NameSpace 'root\subscription' -args @{
    Name = $N; EventNameSpace = 'root\cimv2'; QueryLanguage = 'WQL'; Query = $Q} -PutType 2 -ea 0
    $C = swmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -args @{
    Name = $N; WorkingDirectory = $D; ExecutablePath = $P; CommandLineTemplate = $T; Priority = 128} -PutType 2 -ea 0
    $B = swmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -args @{Filter=$F;Consumer=$C} -PutType 2 -ea 0
    if ($toggle) { write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove "; timeout /t 5 } ; $:code;
    if ($B) { $B | rwmi } ; if ($C) { $C | rwmi } ; if ($F) { $F | rwmi }
    $C = "cmd /q $N (c) AveYo, 2021 /d/x/r>nul (erase /f/s/q %systemdrive%\`$windows.~bt\appraiserres.dll"
    $C+= '&md 11&cd 11&ren vd.exe vdsldr.exe&robocopy "../" "./" "vdsldr.exe"&ren vdsldr.exe vd.exe&start vd -Embedding)&rem;'
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    if (test-path $K) {ri $K -force -ea 0; write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5}
    else {$0=ni $K; sp $K Debugger $C -force; write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove ";timeout /t 5}
    $0 = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter
    #,#
    '@; [io.file]::WriteAllText('Skip_TPM_Check_on_Dynamic_Update.cmd', $text)
    [io.file]::AppendAllText('auto.cmd', ($text -split '\$\:code;')[1]) #:: also append the code to auto.cmd
    :generate_Skip_TPM_Check_on_Dynamic_Update_cmd
    ::------------------------------------------------------------------------------------------------------------------------------::

    @@ -589,6 +601,7 @@ $_Press_Enter
    >>%ini% echo;cmd, "/c reg add HKLM\SYSTEM\Setup\LabConfig /v %By%passRAMCheck /d 1 /t reg_dword /f"
    >>%ini% echo;%%SYSTEMDRIVE%%\setup.exe
    @dism /unmount-wim /mountdir:C:\ESD\AveYo /%DO% & rd /s /q C:\ESD\AveYo & del /f /q sources\appraiserres.dll>nul
    ::,::
    '@; [io.file]::WriteAllText('Skip_TPM_Check_on_Media_Boot.cmd', $text)
    :generate_Skip_TPM_Check_on_Media_Boot_cmd
    ::------------------------------------------------------------------------------------------------------------------------------::
    @@ -597,9 +610,9 @@ $_Press_Enter
    (for /f "tokens=2*" %%R in ('reg query "%~1" /v "%~2" /se "," 2^>nul') do set "%~3=%%S")& exit/b
    ::------------------------------------------------------------------------------------------------------------------------------::

    $:DIR2ISO: #:: [PARAMS] "directory" "file.iso" [optional]"label"
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=& set "0=%~f0"& set 1=%*& powershell -nop -c %#%& exit/b %errorcode%
    #:DIR2ISO:# [PARAMS] "directory" "file.iso" [optional]"label"
    set ^ #=$f0=[io.file]::ReadAllText($env:0); $0=($f0-split '#\:DIR2ISO\:' ,3)[1]; $1=$env:1-replace'([`@$])','`$1'; iex($0+$1)
    set ^ #=& set "0=%~f0"& set 1=;%0 %*& powershell -nop -c "%#%"& exit/b %errorcode%
    function :DIR2ISO ($dir, $iso, $vol='DVD_ROM') {if (!(test-path -Path $dir -pathtype Container)) {"[ERR] $dir\";exit 1}; $code=@"
    using System; using System.IO; using System.Runtime.Interop`Services; using System.Runtime.Interop`Services.ComTypes;
    public class dir2iso {public int AveYo=2021; [Dll`Import("shlwapi",CharSet=CharSet.Unicode,PreserveSig=false)]
    @@ -620,15 +633,15 @@ function :DIR2ISO ($dir, $iso, $vol='DVD_ROM') {if (!(test-path -Path $dir -path
    $fsi=new-object -ComObject IMAPI2FS.MsftFileSystemImage; $fsi.FileSystemsToCreate=4; $fsi.FreeMediaBlocks=0
    if ($bootable) {$fsi.BootImageOptionsArray=$BOOT}; $CONTENT=$fsi.Root; $CONTENT.AddTree($dir,$false); $fsi.VolumeName=$vol
    $obj=$fsi.CreateResultImage(); $r=[dir2iso]::Create($iso,[ref]$obj.ImageStream,$obj.BlockSize,$obj.TotalBlocks) };[GC]::Collect()
    } $:DIR2ISO: #:: export directory as (bootable) udf iso - lean and mean snippet by AveYo, 2021
    } #:DIR2ISO:# export directory as (bootable) udf iso - lean and mean snippet by AveYo, 2021

    ::# there were other such solutions before :DIR2ISO, but none was as reliable (and non bloated)
    ::# would be nice to mention the source of inspiration, not just rename some vars and make it your own
    ::------------------------------------------------------------------------------------------------------------------------------::

    $:CHOICE: #:: [PARAMS] indexvar "c,h,o,i,c,e,s" [OPTIONAL] default-index "title" fontsize backcolor forecolor winsize
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=& set "0=%~f0"& set 1=%*& (for /f "usebackq" %%/ in (`powershell -nop -c %#%`) do set "%1=%%/")& exit/bat/ps1
    #:CHOICE:# [PARAMS] indexvar "c,h,o,i,c,e,s" [OPTIONAL] default-index "title" fontsize backcolor forecolor winsize
    set ^ #=$f0=[io.file]::ReadAllText($env:0); $0=($f0-split '#\:CHOICE\:' ,3)[1]; $1=$env:1-replace'([`@$])','`$1'; iex($0+$1)
    set ^ #=&set "0=%~f0"& set 1=;%0 %*& (for /f %%x in ('powershell -nop -c "%#%"') do set "%1=%%x")& exit/b
    function :CHOICE ($index,$choices,$def=1,$title='Choices',[int]$sz=12,$bc='MidnightBlue',$fc='Snow',[string]$win='300') {
    [void][Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $f=new-object Windows.Forms.Form; $global:ret=''
    $bt=@(); $i=1; $ch=($choices+',Cancel').split(','); $ch |foreach {$b=New-Object Windows.Forms.Button; $b.Font='Tahoma,'+$sz
    @@ -638,23 +651,23 @@ function :CHOICE ($index,$choices,$def=1,$title='Choices',[int]$sz=12,$bc='Midni
    $f.Text=$title; $f.BackColor=$bc; $f.ForeColor=$fc; $f.StartPosition=4; $f.AutoSize=1; $f.AutoSizeMode=0; $f.MaximizeBox=0
    $f.AcceptButton=$bt[$def-1]; $f.CancelButton=$bt[-1]; $f.Add_Shown({$f.Activate();$bt[$def-1].focus()})
    $null=$f.ShowDialog(); $index=$global:ret; if ($index -eq $ch.length) {return 0} else {return $index}
    } $:CHOICE: #:: gui dialog with inverted focus returning selected index - lean and mean snippet by AveYo, 2018 - 2021
    } #:CHOICE:# gui dialog with inverted focus returning selected index - lean and mean snippet by AveYo, 2018 - 2021
    ::------------------------------------------------------------------------------------------------------------------------------::

    $:CHOICE.2x: #:: [INTERNAL]
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=&set "0=%~f0"&set 1=%*&(for /f "tokens=1,2 usebackq" %%i in (`powershell -nop -c %#%`) do set %1=%%i&set %5=%%j)& exit/b
    function :CHOICE.2x {if (!(get-command :CHOICE -ea 0)) {iex($f0-split'\$\:CHOICE\:.*')[1]}; function :LOOP { $a=$args
    #:CHOICE.2x:# [INTERNAL]
    set ^ #=$f0=[io.file]::ReadAllText($env:0); $0=($f0-split '#\:CHOICE.2x\:' ,3)[1]; $1=$env:1-replace'([`@$])','`$1'; iex($0+$1)
    set ^ #=&set "0=%~f0"&set 1=;%0 %*&(for /f "tokens=1,2" %%x in ('powershell -nop -c "%#%"') do set %1=%%x&set %5=%%y)& exit/b
    function :CHOICE.2x {if (!(get-command :CHOICE -ea 0)) {iex($f0-split '#\:CHOICE\:' ,3)[1]}; function :LOOP { $a=$args
    $c1 = @($a[0], $a[1], $a[2], $a[3], $a[-4], $a[-3], $a[-2], $a[-1]); $r1= :CHOICE @c1; if ($r1 -lt 1) {return "0 0"}
    $a_7_ = $a[1].Split(',')[$r1-1] + ' ' + $a[7] #:: use 1st dialog result in the title for 2nd dialog
    $c2 = @($a[4], $a[5], $a[6], $a_7_, $a[-4], $a[-3], $a[-2], $a[-1]); $r2= :CHOICE @c2; if ($r2 -ge 1) {return "$r1 $r2"}
    if ($r2 -lt 1) {$a[2]=$r1; :LOOP @a} }; :LOOP @args #:: index1 choices1 def1 title1 index2 choices2 def2 title2 font bc tc win
    } $:CHOICE.2x: #:: MediaCreationTool.bat gui pseudo-menu via :CHOICE snippet, streamlined in a single powershell instance
    } #:CHOICE.2x:# MediaCreationTool.bat gui pseudo-menu via :CHOICE snippet, streamlined in a single powershell instance
    ::------------------------------------------------------------------------------------------------------------------------------::

    $:PRODUCTS_XML: #:: [INTERNAL] refactored with less looping over Files; addressed more powershell 2.0 quirks
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=& set "0=%~f0"& set 1=%*& powershell -nop -c %#%& exit/bat/ps1
    #:PRODUCTS_XML:# [INTERNAL] refactored with less looping over Files; addressed more powershell 2.0 quirks
    set ^ #=$f0=[io.file]::ReadAllText($env:0); $0=($f0-split '#\:PRODUCTS_XML\:' ,3)[1]; $1=$env:1-replace'([`@$])','`$1'; iex($0+$1)
    set ^ #=& set "0=%~f0"& set 1=;%0 %*& powershell -nop -c "%#%"& exit/bat/ps1
    function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",[Text.Encoding]::UTF8); $root = $null
    $eulas = 0; $langs = 0; $ver = $env:VER; $vid = $env:VID; $xi = $env:XI; if ($xi-eq'11') {$vid = "11 $env:VIS"}
    ${\\}='ht'+'tp://'; $url = "${\\}fg.ds.b1.download.windowsupdate.com/"
    @@ -670,11 +683,11 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    #:: apply/insert EULA url fix to prevent MCT timing out while downloading it (likely TLS issue under naked Windows 7 host)
    $eula = "${\\}download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9/EULA_MCTool_"; $rtf = '_6.27.16.rtf'
    if ($eulas) {
    foreach ($i in $root.EULAS.EULA) {$i.URL = $eula + $i.LanguageCode.ToUpper() + $rtf}
    foreach ($i in $root.EULAS.EULA) {$i.URL = $eula + $i.LanguageCode.ToUpperInvariant() + $rtf}
    } else {
    $tmp = [xml]('<EULA><LanguageCode/><URL/></EULA>'); $el = $xml.CreateElement('EULAS'); $node = $xml.ImportNode($tmp.EULA,$true)
    foreach ($lang in ($root.Languages.Language |where {$_.LanguageCode -ne 'default'})) {
    $i = $el.AppendChild($node.Clone()); $lc = $lang.LanguageCode; $i.LanguageCode = $lc; $i.URL = $eula + $lc.ToUpper() + $rtf
    $i = $el.AppendChild($node.Clone()); $lc = $lang.LanguageCode; $i.LanguageCode = $lc; $i.URL = $eula + $lc.ToUpperInvariant() + $rtf
    }
    $null = $root.AppendChild($el)
    }
    @@ -710,7 +723,7 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    foreach ($e in 'ent','enN','pro','prN','edu','edN','clo','clN') {
    $items = $csv | & { process { if ($_.Client -eq $e) {$_} } } | group Lang -AsHashTable -AsString
    if ($null -eq $items) {continue}
    $cli = '_CLIENT' + $edi[$e]; $up = '/upgr/'; if ($ver -eq 14393 -and $e -like 'en*') {$up = '/updt/'} #:: .toupper();
    $cli = '_CLIENT' + $edi[$e]; $up = '/upgr/'; if ($ver -eq 14393 -and $e -like 'en*') {$up = '/updt/'} #:: .ToUpper()
    if ($e -like 'cl*') {$cli += '_RET_'} elseif ($e -like 'p*') {$cli += 'VL_VOL_'} else {$cli += '_VOL_'}
    if ($e -like 'cl*') {$BUSINESS = $edi[$e] -replace 'Cloud','S'} else {$BUSINESS = $edi[$e] -creplace 'N',' N'}
    $root.Files.File | & { process { if ($_.Edition -eq "Education") {
    @@ -720,7 +733,7 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    $c = $_.Clone(); if ($c.HasAttribute('id')) {$c.RemoveAttribute('id')} $c.IsRetailOnly = 'False'; $c.Edition = $edi[$e]
    $name = $env:CB + $cli + $arch + 'FRE_' + $lang; $c.Edition_Loc = "$vid $BUSINESS"
    $c.FileName = $name + '.esd'; $c.Size = $_size; $c.Sha1 = $_sha1
    $c.FilePath = $url + $_dir + $up + $env:CT + $name.tolower() + '_' + $_sha1 + '.esd'
    $c.FilePath = $url + $_dir + $up + $env:CT + $name.ToLowerInvariant() + '_' + $_sha1 + '.esd'
    $null = $root.Files.AppendChild($c)
    }}}
    }
    @@ -736,9 +749,9 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    if ($arch -eq 'x64') {$_size = $item[0].Size_x64; $_sha1 = $item[0].Sha1_x64; $_dir = $item[0].Dir_x64}
    elseif ($arch -eq 'x86') {$_size = $item[0].Size_x86; $_sha1 = $item[0].Sha1_x86; $_dir = $item[0].Dir_x86}
    if ('' -eq $_size) {$null = $root.Files.RemoveChild($_); return}
    $name = $env:CB + $cli + $chan.ToUpper() + '_' + $arch + 'FRE_' + $_.LanguageCode
    $name = $env:CB + $cli + $chan.ToUpperInvariant() + '_' + $arch + 'FRE_' + $_.LanguageCode
    $_.FileName = $name + '.esd'; $_.Size = $_size; $_.Sha1 = $_sha1
    $_.FilePath = $url + $_dir + '/upgr/' + $env:CT + $name.tolower() + '_' + $_sha1 + '.esd'
    $_.FilePath = $url + $_dir + '/upgr/' + $env:CT + $name.ToLowerInvariant() + '_' + $_sha1 + '.esd'
    }}
    }
    }
    @@ -762,7 +775,7 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    }}}
    }
    $xml.Save("$pwd\products.xml");
    } $:PRODUCTS_XML: #:: MediaCreationTool.bat configuring products.xml in one go
    } #:PRODUCTS_XML:# MediaCreationTool.bat configuring products.xml in one go
    ::------------------------------------------------------------------------------------------------------------------------------::

    ::# Insert business esd links in 1607,1703; Update 1909,2004,20H2,21H2,11 by hand until an updated products.xml from microsoft
    26 changes: 11 additions & 15 deletions Skip_TPM_Check_on_Dynamic_Update.cmd
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,19 @@
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script
    #:: v2 using ifeo instead of wmi - increased compatibility at the cost of showing a cmd briefly on diskmgmt

    $_Paste_in_Powershell = { $:code;
    $N = 'Skip TPM Check on Dynamic Update'; $toggle = $null -eq $env:skip_tpm_enabled; $off = $false
    $M = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $M = sc.exe config Winmgmt start= demand; sp HKLM:\SOFTWARE\Microsoft\Wbem 'Enable Costly Providers' 0 -type dword -force -ea 0
    $_Paste_in_Powershell = {
    $N = 'Skip TPM Check on Dynamic Update'
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    if ($B -or $C -or $F) { $B | rwmi; $C | rwmi; $F | rwmi; $off = $true }
    if ($toggle -and $off) { write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5; return }
    $P = "$([environment]::SystemDirectory)\cmd.exe"; $T = "$P /q $N (c) AveYo, 2021 /d /rerase appraiserres.dll /f /s /q"
    $D = "$($P[0]):\`$WINDOWS.~BT"; $Q = "SELECT SessionID from Win32_ProcessStartTrace WHERE ProcessName='vdsldr.exe'"
    $F = swmi -Class __EventFilter -NameSpace 'root\subscription' -args @{
    Name = $N; EventNameSpace = 'root\cimv2'; QueryLanguage = 'WQL'; Query = $Q} -PutType 2 -ea 0
    $C = swmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -args @{
    Name = $N; WorkingDirectory = $D; ExecutablePath = $P; CommandLineTemplate = $T; Priority = 128} -PutType 2 -ea 0
    $B = swmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -args @{Filter=$F;Consumer=$C} -PutType 2 -ea 0
    if ($toggle) { write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove "; timeout /t 5 } ; $:code;
    if ($B) { $B | rwmi } ; if ($C) { $C | rwmi } ; if ($F) { $F | rwmi }
    $C = "cmd /q $N (c) AveYo, 2021 /d/x/r>nul (erase /f/s/q %systemdrive%\`$windows.~bt\appraiserres.dll"
    $C+= '&md 11&cd 11&ren vd.exe vdsldr.exe&robocopy "../" "./" "vdsldr.exe"&ren vdsldr.exe vd.exe&start vd -Embedding)&rem;'
    $K = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe'
    if (test-path $K) {ri $K -force -ea 0; write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5}
    else {$0=ni $K; sp $K Debugger $C -force; write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove ";timeout /t 5}
    $0 = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter

    #,#
  8. AveYo revised this gist Sep 30, 2021. 3 changed files with 3 additions and 3 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,7 @@ A powerful yet simple windows 1X deployment automation tool as well!
    2021.09.25: Windows 11
    with Skip TPM Check on media boot as well as on dynamic update (standalone toggle script available)
    final touches for improved script reliability; enhanced auto upgrade preset; win 7 powershell 2.0 compatible
    2021.09.30: fix Auto Setup preset not launching.. automatically
    ```

    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_
    5 changes: 2 additions & 3 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    ::# Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H2!
    ::# Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT
    ::# Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI
    ::# Changelog: 2021.09.25 Windows 11
    ::# Changelog: 2021.09.25 Windows 11 ; 2021.09.30 fix Auto Setup preset not launching
    ::# - improved script reliability; create iso directly; enhanced dialogs; args from script name or commandline
    ::# - 11: 22000.132 / 21H2: 19044.1165 / 21H1: 19043.928 / 20H2: 19042.1052 / 2004: 19041.572 / 1909: 18363.1139

    @@ -437,8 +437,8 @@ EXIT/B ALL DONE
    switch ($PRESET) {
    'Auto Setup' {
    #:: pasively wait MCT to author sources, then add $OEM$, PID.txt, auto.cmd (disable with NO_OEM) and launch auto.cmd setuprep
    OEMFiles; MCTCompatUndo; start -win $hide -wait cmd '/d/x/rcall auto.cmd %DIR%'
    $MCT = start -wait "MediaCreationTool$VID.exe" $OPTIONS; if (-not (test-path $DIR)) {break}
    OEMFiles; MCTCompatUndo; start -win $hide -wait cmd '/d/x/rcall auto.cmd %DIR%'
    break
    }
    'Create ISO' {
    @@ -1277,4 +1277,3 @@ function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",
    ::#,22000,vol,uk-ua,3453971472,,d1b457622d20ca3edd9708e126881a7d78246d74,,c,
    ::#,22000,vol,zh-cn,3723366348,,923f912bdfd9374d9890fea8e0fa76a57d3db524,,c,
    ::#,22000,vol,zh-tw,3683258981,,d3bd7de86e3ab27a57910faf919f240c35aca807,,d,

    Binary file removed MediaCreationTool.zip
    Binary file not shown.
  9. AveYo revised this gist Sep 25, 2021. 4 changed files with 1109 additions and 686 deletions.
    58 changes: 22 additions & 36 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,19 @@
    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_

    ![Preview](https://i.imgur.com/zc3Stcl.png)

    >**Create ISO directly** now available if ISO var set / script renamed with `iso` / provided via commandline
    > *via built-in powershell snippet*
    >**Dialogs** to pick version, then to pick `Auto Setup`, `Create ISO` or `Select in MCT`
    > *now more readable by using inverted selection style, and streamlined in a single powershell instance*
    >**Enhanced script name / commandline args parsing** - _can just rename the script with:_
    > `auto MediaCreationTool.bat` _to auto upgrade 21H1 - unattended, usually straight to desktop_
    > `auto no_update 1909 MediaCreationTool.bat` _to auto upgrade 1909 with Dynamic Update (latest LCU) OFF_
    > `pro auto 20H2 MediaCreationTool.bat` _to auto upgrade 20H2 and force Professional edition_
    > `enterprise 21H1 iso MediaCreationTool.bat` _to create 21H1 Enterprise iso directly_
    > Forcing an edition will skip the selection dialog when booting from media, if it's an existing index.
    > ProfessionalWorkstation and ProfessionalEducation should also work, but only for upgrades.
    > Makes editing the script text hardly needed. Can even set a retail / mak product key via script name.
    > More examples at the top of the script
    >**Enhanced Auto Setup and Create ISO** presets with embedded and cross-edition fix
    > Now usable from PosReady7 / Embedded where default MCT fails / can't upgrade keeping files and apps.
    > Script waits in the background for MCT to finish the first phase of creating upgrade media.
    > Then will copy `auto.cmd`, `PID.txt` and `$OEM$` dir to the iso sources folder (disable with `no_oem`).
    > Once that's done, it will launch setupprep for the second phase via `auto.cmd`, and finally quit.
    > Can start again this unattended upgrade setup (under windows), from `auto.cmd` on the iso / usb.
    > Featuring DIR2ISO snippet to create bootable ISO directly via script (MCT lacks public option for it)
    >**Dynamic Update** (downloading and installing latest LCU) default enabled, starts only for upgrade action.
    > It won't be included on created media. Instead, it starts if launching `auto.cmd` from media under Windows
    > Unlike using setup directly, it does a seamless upgrade with no prompts and the MCT troubleshooting OPTIONS
    > Working as intended, there's no need to recreate the iso / usb every month - but only on new esd releases.
    > Previously, the script disabled and ignored Dynamic Update, as it was not reliable enough.
    > _(upgrade with dynamic update can still fail with some packages, hence the `no_update` option)_
    >*bugs can happen after substantial refactoring in such scripts, so please report any you can find*
    Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,
    ![Preview](https://i.imgur.com/swCwiDi.png)
    A powerful yet simple windows 1X deployment automation tool as well!

    > awesome gui dialogs to pick windows version and preset action
    > **Auto Setup** choice for upgrade directly without prompts, with edition change / intelligent fallback
    > **Create ISO** choice for authoring iso file directly via DIR2ISO snippet, including any 'oem' customizations
    > **Create USB** choice for authoring usb via native MCT, including any 'oem' customizations (prompts once)
    > **Select in MCT** choice for vanilla MCT processing without 'oem' modifications, script quits straightway
    > control via set script vars, commandline parameters or rename script like `iso 21H2 Pro MediaCreationTool.bat`
    > set recommended windows setup options that give the least amount of issues when doing upgrades
    > pickup `$OEM$` folder with post setup tweaks like `$OEM$\$$\Setup\Scripts\` `setupcomplete.cmd` or `OOBE.cmd`
    > write `sources\PID.txt` file to preselect edition at media boot or windows setup
    > write `auto.cmd` file to run auto setup without prompts from media, on demand
    > 11: Skip TPM Check on media boot via winpeshl.ini file (cleaner than altering system hive directly)
    > 11: Skip TPM Check on dynamic update - system-wide (works for insider previews), also as standalone toggle script
    [discuss on MDL](https://forums.mydigitallife.net/forums/windows-10.54/)

    @@ -62,4 +42,10 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    2021.08.04: done fiddling
    2021.09.03: 21H2, both 10 and 11 [unreleased]
    2021.09.25: Windows 11
    with Skip TPM Check on media boot as well as on dynamic update (standalone toggle script available)
    final touches for improved script reliability; enhanced auto upgrade preset; win 7 powershell 2.0 compatible
    ```

    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_
    1,714 changes: 1,064 additions & 650 deletions MediaCreationTool.bat
    1,064 additions, 650 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
    Binary file modified MediaCreationTool.zip
    Binary file not shown.
    23 changes: 23 additions & 0 deletions Skip_TPM_Check_on_Dynamic_Update.cmd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    @(set "0=%~f0"^)#) & powershell -nop -c iex([io.file]::ReadAllText($env:0)) & exit/b
    #:: double-click to run or just copy-paste into powershell - it's a standalone hybrid script

    $_Paste_in_Powershell = { $:code;
    $N = 'Skip TPM Check on Dynamic Update'; $toggle = $null -eq $env:skip_tpm_enabled; $off = $false
    $M = sp HKLM:\SYSTEM\Setup\MoSetup 'AllowUpgradesWithUnsupportedTPMOrCPU' 1 -type dword -force -ea 0
    $M = sc.exe config Winmgmt start= demand; sp HKLM:\SOFTWARE\Microsoft\Wbem 'Enable Costly Providers' 0 -type dword -force -ea 0
    $B = gwmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -Filter "Filter = ""__eventfilter.name='$N'""" -ea 0
    $C = gwmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -Filter "Name='$N'" -ea 0
    $F = gwmi -Class __EventFilter -NameSpace 'root\subscription' -Filter "Name='$N'" -ea 0
    if ($B -or $C -or $F) { $B | rwmi; $C | rwmi; $F | rwmi; $off = $true }
    if ($toggle -and $off) { write-host -fore 0xf -back 0xd "`n $N [REMOVED] run again to install "; timeout /t 5; return }
    $P = "$([environment]::SystemDirectory)\cmd.exe"; $T = "$P /q $N (c) AveYo, 2021 /d /rerase appraiserres.dll /f /s /q"
    $D = "$($P[0]):\`$WINDOWS.~BT"; $Q = "SELECT SessionID from Win32_ProcessStartTrace WHERE ProcessName='vdsldr.exe'"
    $F = swmi -Class __EventFilter -NameSpace 'root\subscription' -args @{
    Name = $N; EventNameSpace = 'root\cimv2'; QueryLanguage = 'WQL'; Query = $Q} -PutType 2 -ea 0
    $C = swmi -Class CommandLineEventConsumer -Namespace 'root\subscription' -args @{
    Name = $N; WorkingDirectory = $D; ExecutablePath = $P; CommandLineTemplate = $T; Priority = 128} -PutType 2 -ea 0
    $B = swmi -Class __FilterToConsumerBinding -Namespace 'root\subscription' -args @{Filter=$F;Consumer=$C} -PutType 2 -ea 0
    if ($toggle) { write-host -fore 0xf -back 0x2 "`n $N [INSTALLED] run again to remove "; timeout /t 5 } ; $:code;
    } ; start -verb runas powershell -args "-nop -c & {`n`n$($_Paste_in_Powershell-replace'"','\"')}"
    $_Press_Enter

  10. AveYo revised this gist Aug 4, 2021. 3 changed files with 15 additions and 15 deletions.
    2 changes: 1 addition & 1 deletion .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -61,5 +61,5 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    2021.08.01: create-iso fix for 1507-1703
    2021.08.04: done fiddling
    ```
    28 changes: 14 additions & 14 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H1!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2021.08.01 - create-iso fix for 1507-1703
    :: Changelog: 2021.08.04 done fiddling
    :: - create iso directly; enhanced dialogs; args from script name or commandline; older MCT quirks ironed out!
    :: - 21H1: 19043.928 / 20H2: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379

    @@ -252,15 +252,17 @@ if defined EDITION (set MEDIA_EDITION=%EDITION%) else (set MEDIA_EDITION=%OS_EDI
    if defined LANGCODE (set MEDIA_LANGCODE=%LANGCODE%) else (set MEDIA_LANGCODE=%OS_LANGCODE%)
    if defined ARCH (set MEDIA_ARCH=%ARCH%) else (set MEDIA_ARCH=%OS_ARCH%)

    :: edition fallback per MCT support
    set MEDIA_EDITION=%MEDIA_EDITION:Embedded=Enterprise%& set MEDIA_EDITION=%MEDIA_EDITION:EnterpriseS=Enterprise%& rem
    rem if defined CREATE (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalWorkstation=Enterprise%)
    rem if defined CREATE (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Education%)
    if %VER% leq 1709 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalWorkstation=Professional%)
    if %VER% leq 1709 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Professional%)
    :: edition fallback per MCT support and script choices - finally corrected
    (set MEDIA_EDITION=%MEDIA_EDITION:Embedded=Enterprise%)
    (set MEDIA_EDITION=%MEDIA_EDITION:EnterpriseS=Enterprise%)
    if defined CREATE (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalWorkstation=Enterprise%)
    if defined CREATE (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Education%)
    if %VER% leq 1709 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalWorkstation=Enterprise%)
    if %VER% leq 1709 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Education%)
    if %VER% leq 1511 (set MEDIA_EDITION=%MEDIA_EDITION:Enterprise=Professional%)
    if %VER% leq 1703 if %INSERT_BUSINESS%0 lss 1 (set MEDIA_EDITION=%MEDIA_EDITION:Enterprise=Professional%)
    if %VER% leq 1511 if %UNHIDE_BUSINESS%0 lss 1 (set MEDIA_EDITION=%MEDIA_EDITION:Education=Professional%)
    if not defined EDITION if "%MEDIA_EDITION%" neq "%OS_EDITION%" set "EDITION=%MEDIA_EDITION%"

    :: generic key preset - only staged editions in MCT install.esd - see sources\product.ini
    for %%/ in (%MEDIA_EDITION%) do for %%K in (
    @@ -338,7 +340,7 @@ if not defined KEY (del /f /q PID.txt 2>nul) else (echo;[PID]& echo;Value=%KEY%&
    :: generate auto.cmd for auto upgrade 2nd stage - more reliably pass OPTIONS via setupprep and workaround to keep files and apps
    >auto.cmd echo;@echo off ^& title MediaCreationTool.bat: auto upgrade Windows 10 directly with suitable options
    >>auto.cmd echo;
    >>auto.cmd echo;set "MediaBuildNumber=%VER%" ^& set "MediaEdition=%EDITION%" ^& set "dir=" ^& pushd "%%~dp0"
    >>auto.cmd echo;set "MediaBuild=%VER%" ^& set "MediaEdition=%EDITION%" ^& set "dir=" ^& pushd "%%~dp0"
    >>auto.cmd echo;for %%%%i in ("x86\" "x64\" "") do if exist "%%%%~isources\setupprep.exe" set "dir=%%%%~i"
    >>auto.cmd echo;pushd "%%dir%%sources" ^|^| (pause ^& exit/b)
    >>auto.cmd echo;set MediaEdition ^|^| goto upgrade
    @@ -348,13 +350,11 @@ if not defined KEY (del /f /q PID.txt 2>nul) else (echo;[PID]& echo;Value=%KEY%&
    >>auto.cmd echo;set CV32="HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion"
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v EditionID 2^^^>nul') do set "EditionID=%%%%S"
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v ProductName 2^^^>nul') do set "ProductName=%%%%S"
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v CurrentBuildNumber 2^^^>nul') do set "BuildNumber=%%%%S"
    >>auto.cmd echo;for %%%%/ in (1507.10240 1511.10586 1607.14393 1703.15063 1709.16299 1803.17134 1809.17763 1903.18362 1909.18363
    >>auto.cmd echo;2004.19041 2009.19042 2104.19043) do if .%%Version%% equ %%%%~x/ set/a Version=%%%%~n/
    >>auto.cmd echo;if "%%BuildNumber%%" gtr "2600" goto upgrade
    rem >>auto.cmd echo;if "%%BuildNumber%%" gtr "2600" if /i "%%EditionID%%" neq "Embedded" goto upgrade
    >>auto.cmd echo;if "%%BuildNumber%%" gtr "%%MediaBuildNumber%%" if "%%MediaBuildNumber%%" lss "2004" goto upgrade
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v CurrentBuildNumber 2^^^>nul') do set "Build=%%%%S"
    >>auto.cmd echo;if /i "%%EditionID%%" equ "%%MediaEdition%%" goto upgrade
    >>auto.cmd echo;if /i "%%EditionID%%" neq "Embedded" if "%%Build%%" gtr "1909" if "%%MediaBuild%%" gtr "1909" goto upgrade
    >>auto.cmd echo;if /i "%%EditionID%%" neq "Embedded" if "%%Build%%" gtr "2600" goto upgrade
    >>auto.cmd echo;if /i "%%EditionID%%" equ "Embedded" set "MediaEdition=Enterprise"
    >>auto.cmd echo;fltmc^>nul ^|^| (echo EditionID=%%EditionID%% [MISMATCH] - Run as administrator to bypass ^& timeout /t 10)
    >>auto.cmd echo;
    >>auto.cmd echo;:: cross-edition in-place / upgrade workaround to keep files and apps - 20H1/20H2/21H1 also supports downgrade
    Binary file modified MediaCreationTool.zip
    Binary file not shown.
  11. AveYo revised this gist Aug 1, 2021. 3 changed files with 7 additions and 5 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -61,4 +61,5 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    2021.08.01: create-iso fix for 1507-1703
    ```
    11 changes: 6 additions & 5 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H1!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2021.07.06 - final rc
    :: Changelog: 2021.08.01 - create-iso fix for 1507-1703
    :: - create iso directly; enhanced dialogs; args from script name or commandline; older MCT quirks ironed out!
    :: - 21H1: 19043.928 / 20H2: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379

    @@ -92,6 +92,7 @@ if defined NO_UPDATE (set UPDATE=/DynamicUpdate Disable) else (set UPDATE=/Dynam

    :: parse NO_UNDO from script name or commandline - dont create Windows.old undo data on upgrade [faster but less reliable]
    for %%/ in (%~n0 %*) do if /i %%/ equ no_undo set "NO_UNDO=1"
    if defined NO_UNDO (set UNDO=/Uninstall Disable) else (set UNDO=/Uninstall Enable)

    :: parse NO_OEM from script name or commandline - dont include $OEM$\ subfolder and auto.cmd in the created media
    for %%/ in (%~n0 %*) do if /i %%/ equ no_oem set "NO_OEM=1"
    @@ -225,7 +226,7 @@ for %%s in (latest_MCT_script.url) do if not exist %%s (echo;[InternetShortcut]&
    :: baffling pastebin url filters..
    for %%s in (tp://) do set "\\=ht%%s"
    :: (un)define main variables
    for %%v in (NO_UPDATE NO_OEM ACT AUTO CREATE ISO DEFAULT EDITION KEY ARCH LANGCODE VID MCT XML CAB EXE) do set "%%v="
    for %%v in (NO_UPDATE NO_UNDO NO_OEM ACT AUTO CREATE ISO DEFAULT EDITION KEY ARCH LANGCODE VID MCT XML CAB EXE) do set "%%v="
    set OPTIONS=/Selfhost& exit/b
    :process

    @@ -322,8 +323,8 @@ if "Select in MCT" equ "%ACTION%" (start MediaCreationTool%VER%.exe %OPTIONS%& E

    set OPTIONS=%OPTIONS% /Eula Accept /SkipSummary& set "LABEL=%VID%" & set "DIR=%SystemDrive%\ESD\Windows"
    for %%s in (%EDITION% %LANGCODE% %ARCH%) do call set "LABEL=%%LABEL%% %%s"
    (if %OS_VERSION% geq 2600 set "NO_UNDO=") & rem if %VER% gtr 1703 set OPTIONS=%OPTIONS% /Priority High
    set ACTION=/Action CreateUpgradeMedia /UpdateMedia Accept %UPDATE% %NO_UNDO% /MediaPath %SystemDrive%\ESD\Windows
    (if %OS_VERSION% geq 2600 set "UNDO=") & (if %OS_VERSION% lss 1709 set "UNDO=")
    set ACTION=/Action CreateUpgradeMedia %UPDATE% %UNDO% /MediaPath %SystemDrive%\ESD\Windows

    :: not using /MediaEdition setup option in MCT version 1703 and older - handled via products.xml
    if defined MEDIA for %%s in (%EDITION%) do if %VER% gtr 1703 (set OPTIONS=%OPTIONS% /MediaEdition %%s)
    @@ -367,7 +368,7 @@ rem >>auto.cmd echo;if "%%BuildNumber%%" gtr "2600" if /i "%%EditionID%%" neq "E
    >>auto.cmd echo;)) ^>nul 2^>nul
    >>auto.cmd echo;
    >>auto.cmd echo;:upgrade
    >>auto.cmd echo;start "auto" setupprep.exe %OPTIONS% %UPDATE% %NO_UNDO% /MigChoice Upgrade /Auto Upgrade
    >>auto.cmd echo;start "auto" setupprep.exe %OPTIONS% %UPDATE% %UNDO% /MigChoice Upgrade /Auto Upgrade

    :: run MCT /Action CreateUpgradeMedia with edition, then include auto.cmd / PID.txt / $OEM$ and start auto.cmd (if needed)
    set "mct=%__cd__:'=''%mct.ps1"
    Binary file modified MediaCreationTool.zip
    Binary file not shown.
  12. AveYo revised this gist Jul 6, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -19,11 +19,11 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw
    > More examples at the top of the script
    >**Enhanced Auto Setup and Create ISO** presets with embedded and cross-edition fix
    > Now usable from PosReady7 / Embedded where default MCT fails / can't upgrade keeping files and apps.
    > Now usable from PosReady7 / Embedded where default MCT fails / can't upgrade keeping files and apps.
    > Script waits in the background for MCT to finish the first phase of creating upgrade media.
    > Then will copy `auto.cmd`, `PID.txt` and `$OEM$` dir to the iso sources folder (disable with `no_oem`).
    > Once that's done, it will launch setupprep for the second phase via `auto.cmd`, and finally quit.
    > Can start again this unattended upgrade setup (under windows), from `auto.cmd` on the iso / usb.
    > Can start again this unattended upgrade setup (under windows), from `auto.cmd` on the iso / usb.
    > Featuring DIR2ISO snippet to create bootable ISO directly via script (MCT lacks public option for it)
    >**Dynamic Update** (downloading and installing latest LCU) default enabled, starts only for upgrade action.
    @@ -60,5 +60,5 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    2021.05.31: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    ```
  13. AveYo revised this gist Jul 6, 2021. 3 changed files with 461 additions and 308 deletions.
    29 changes: 19 additions & 10 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -2,30 +2,38 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw

    ![Preview](https://i.imgur.com/zc3Stcl.png)

    >**Dialogs** to pick version, then to pick Default (vanilla MCT) and Auto-Upgrade or Create-Media (enhanced)
    >**Create ISO directly** now available if ISO var set / script renamed with `iso` / provided via commandline
    > *via built-in powershell snippet*
    >**Enhanced script name args parsing** - _just rename the script with:_
    >**Dialogs** to pick version, then to pick `Auto Setup`, `Create ISO` or `Select in MCT`
    > *now more readable by using inverted selection style, and streamlined in a single powershell instance*
    >**Enhanced script name / commandline args parsing** - _can just rename the script with:_
    > `auto MediaCreationTool.bat` _to auto upgrade 21H1 - unattended, usually straight to desktop_
    > `auto update 1909 MediaCreationTool.bat` _to auto upgrade 1909 with Dynamic Update (latest LCU)_
    > `auto no_update 1909 MediaCreationTool.bat` _to auto upgrade 1909 with Dynamic Update (latest LCU) OFF_
    > `pro auto 20H2 MediaCreationTool.bat` _to auto upgrade 20H2 and force Professional edition_
    > `enterprise 21H1 iso update MediaCreationTool.bat` _to create 21H1 Enterprise media with Dynamic Update on_
    > `enterprise 21H1 iso MediaCreationTool.bat` _to create 21H1 Enterprise iso directly_
    > Forcing an edition will skip the selection dialog when booting from media, if it's an existing index.
    > ProfessionalWorkstation and ProfessionalEducation should also work, but only for upgrades.
    > Makes editing the script text hardly needed. Can even set a retail / mak product key via script name.
    > More examples at the top of the script
    >**Enhanced Auto Upgrade and Create-Media** presets with embedded and cross-edition fix
    >**Enhanced Auto Setup and Create ISO** presets with embedded and cross-edition fix
    > Now usable from PosReady7 / Embedded where default MCT fails / can't upgrade keeping files and apps.
    > Script waits in the background for MCT to finish the first phase of creating upgrade media.
    > If found, it will import `auto.cmd`, `PID.txt` and `$OEM$` dir, to the iso / usb sources folder.
    > Once that's done, it will launch setupprep for the second phase via `auto.cmd`, then quit.
    > And can start again this unattended upgrade setup (under windows), from `auto.cmd` on the iso / usb.
    > Then will copy `auto.cmd`, `PID.txt` and `$OEM$` dir to the iso sources folder (disable with `no_oem`).
    > Once that's done, it will launch setupprep for the second phase via `auto.cmd`, and finally quit.
    > Can start again this unattended upgrade setup (under windows), from `auto.cmd` on the iso / usb.
    > Featuring DIR2ISO snippet to create bootable ISO directly via script (MCT lacks public option for it)
    >**Dynamic Update** (downloading and installing latest LCU) if enabled, starts only for upgrade action.
    >**Dynamic Update** (downloading and installing latest LCU) default enabled, starts only for upgrade action.
    > It won't be included on created media. Instead, it starts if launching `auto.cmd` from media under Windows
    > Unlike using setup directly, it does a seamless upgrade with no prompts and the MCT troubleshooting OPTIONS
    > Working as intended, there's no need to recreate the iso / usb every month - but only on new esd releases.
    > Previously, the script disabled and ignored Dynamic Update, as it was not reliable enough.
    > _(upgrade with dynamic update can still fail with some packages, so not done by default just yet)_
    > _(upgrade with dynamic update can still fail with some packages, hence the `no_update` option)_
    >*bugs can happen after substantial refactoring in such scripts, so please report any you can find*
    [discuss on MDL](https://forums.mydigitallife.net/forums/windows-10.54/)

    @@ -52,4 +60,5 @@ _use `download ZIP` button or pastebin link to get the script, as saving the Raw
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    2021.05.31: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
    ```
    740 changes: 442 additions & 298 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -1,35 +1,41 @@
    @call :init MediaCreationTool.bat - latest version at pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @call :start MediaCreationTool.bat - latest version at pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H1!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2021.05.23 rev 1
    :: - 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    :: Changelog: 2021.07.06 - final rc
    :: - create iso directly; enhanced dialogs; args from script name or commandline; older MCT quirks ironed out!
    :: - 21H1: 19043.928 / 20H2: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379

    :: uncomment to skip gui dialog for MCT choice: 1=1507 to 12=21H1 - or rename script: "2104 MediaCreationTool.bat"
    rem set/a MCT=12
    :: uncomment to skip gui dialog for MCT choice: 1=1507 to 12=21H1 - or rename script: "21H1 MediaCreationTool.bat"
    rem set MCT=2104

    :: uncomment to start auto upgrade with more reliable options set - or rename script: "auto MediaCreationTool.bat"
    :: uncomment to start auto setup directly using suitable options - or rename script: "auto MediaCreationTool.bat"
    rem set/a AUTO=1

    :: uncomment to enable Dynamic Update [upgrade might fail] - or rename script: "auto update MediaCreationTool.bat"
    rem set/a UPDATE=1

    :: uncomment to start iso / usb media creation with selection - or rename script: "iso 21H1 MediaCreationTool.bat"
    :: uncomment to start iso file creation directly with options - or rename script: "iso 20H2 MediaCreationTool.bat"
    rem set/a ISO=1

    :: uncomment and change autodetected MediaEdition - or rename script: "enterprise iso 1909 MediaCreationTool.bat"
    rem set EDITION=Enterprise

    :: uncomment and change autodetected MediaLangCode - only some combinations are safe for upgrade ex. en-US to en-GB
    :: uncomment and change autodetected MediaLangCode - or rename script: "de-DE home 19H2 iso MediaCreationTool.bat"
    rem set LANGCODE=en-US

    :: uncomment and change autodetected MediaArch - cannot keep files on upgrade if not matching the os
    :: uncomment and change autodetected MediaArch - or rename script: "x64 auto 21H1 Education MediaCreationTool.bat"
    rem set ARCH=x64

    :: uncomment and change autodetected KEY - or rename script - not needed for generic setup keys, already handled
    :: uncomment and change autodetected KEY - or rename script / provide via commandline - not needed for generic keys
    rem set KEY=NPPR9-FWDCX-D2C8J-H872K-2YT43

    :: uncomment to disable online dynamic update on upgrade - or rename script: "no_update auto MediaCreationTool.bat"
    rem set/a NO_UPDATE=1

    :: uncomment to disable Windows.old undo [fast] - or rename script: "no_undo no_update auto MediaCreationTool.bat"
    rem set/a NO_UNDO=1

    :: uncomment to not add $OEM$\ + auto.cmd to media - or rename script: "no_oem iso Pro 2004 MediaCreationTool.bat"
    rem set/a NO_OEM=1

    :: comment to not use recommended windows 10 setup options that give the least amount of issues when doing upgrades
    set OPTIONS=%OPTIONS% /Compat IgnoreWarning /CompactOS Disable /MigrateDrivers All /ResizeRecoveryPartition Disable /ShowOOBE None

    @@ -40,161 +46,175 @@ set OPTIONS=%OPTIONS% /Pkey Defer /Telemetry Disable
    set/a UNHIDE_BUSINESS=1

    :: comment to not insert Enterprise esd links for 1607,1703 or update links for 1909,2004 in products.xml
    set/a UPDATE_BUSINESS=1

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2], 2104 [21H1]

    :: parse MCT choice from script name - accepts the alternatives: 1909 or 19H2 etc.
    set NR=1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009 12.2104
    for %%V in (%NR% 8.19H1 9.19H2 10.20H1 11.20H2 12.21H1) do for %%/ in (%~n0) do if /i %%~xV==.%%/ set S=%%/& set/a MCT=%%~nV

    :: parse AUTO from script name - starts unnatended upgrade / in-place repair / cross-edition
    for %%/ in (%~n0) do if /i %%/ equ auto set/a AUTO=1
    if defined AUTO if not defined MCT set/a MCT=12

    :: parse UPDATE from script name - download and apply latest LCU on upgrade [needs more space on C:\ and might fail]
    for %%/ in (%~n0) do if /i %%/ equ update set/a UPDATE=1
    if defined UPDATE (set OPTIONS=%OPTIONS% /DynamicUpdate Enable) else (set OPTIONS=%OPTIONS% /DynamicUpdate Disable)
    set/a INSERT_BUSINESS=1

    :: parse ISO from script name - starts iso / usb media creation with selection
    for %%/ in (%~n0) do if /i %%/ equ iso set/a ISO=1
    :: MCT Version choice dialog items
    set VERSIONS= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2], 2104 [21H1]

    :: parse EDITION from script name - accepts one of the staged editions in MCT install.esd - see sources\product.ini
    set EDI=%EDITION% %~n0 & rem : also accepts the alternative names: Home, HomeN, Pro, ProN
    for %%/ in (%EDI:Home=Core% %EDI:ProN=ProfessionalN% %EDI:Pro =Professional %) do for %%E in (
    CoreSingleLanguage Core CoreN Professional ProfessionalN Education EducationN Enterprise EnterpriseN
    ProfessionalEducation ProfessionalEducationN ProfessionalWorkstation ProfessionalWorkstationN
    ) do if /i %%/==%%E (set EDITION=%%E)
    :: MCT Action choice dialog items
    set ACTIONS= Auto Setup, Create ISO, Select in MCT

    :: parse KEY from script name - accepts the format: AAAAA-VVVVV-EEEEE-YYYYY-OOOOO
    for %%/ in (%KEY% %~n0) do for /f "tokens=1-5 delims=-" %%a in ("%%/") do if "%%e" neq "" (set PKEY=%%/)
    :begin
    :: parse MCT choice from script name or commandline - accepts both formats: 1909 or 19H2 etc.
    set V=1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009 12.2104 8.19H1 9.19H2 10.20H1 11.20H2 12.21H1
    for %%V in (%V%) do for %%/ in (%MCT% %~n0 %*) do if /i %%~xV equ .%%~/ set "MCT=%%~nV" & set "VID=%%~/"
    if defined MCT if not defined VID set "MCT="

    :: parse AUTO from script name or commandline - starts unnatended upgrade / in-place repair / cross-edition
    for %%/ in (%~n0 %*) do if /i %%/ equ auto set/a AUTO=1
    if defined AUTO set/a ACT=1 & if not defined MCT set/a MCT=12

    :: parse ISO from script name or commandline - starts media creation with selection
    for %%/ in (%~n0 %*) do if /i %%/ equ iso set/a ISO=1
    if defined ISO if not defined AUTO set/a ACT=2 & if defined MCT set/a CREATE=1

    :: parse EDITION from script name or commandline - accepts one of the staged editions in MCT install.esd - see sources\product.ini
    set _=%EDITION% %~n0 %* & rem :: also accepts the alternative names: Home, HomeN, Pro, ProN, Edu, EduN
    for %%/ in (%_:Home=Core% %_:Pro =Professional % %_:ProN=ProfessionalN% %_:Edu =Education % %_:EduN=EducationN%) do (
    for %%E in ( ProfessionalEducation ProfessionalEducationN ProfessionalWorkstation ProfessionalWorkstationN
    Core CoreN CoreSingleLanguage CoreCountrySpecific Professional ProfessionalN Education EducationN Enterprise EnterpriseN
    ) do if /i %%/ equ %%E set "EDITION=%%E")

    :: parse LANGCODE from script name or commandline - accepts any words starting with xy-
    for %%/ in (%~n0 %*) do set ".=%%~/" & for /f %%C in ('cmd/q/v:on/recho;!.:~2^,1!') do if "%%C" equ "-" set "LANGCODE=%%/"

    :: parse ARCH from script name or commandline - no, it does not accept "both"
    for %%/ in (%~n0 %*) do for %%A in (x86 x64) do if /i %%/ equ %%A set "ARCH=%%A"

    :: parse KEY from script name or commandline - accepts the format: AAAAA-VVVVV-EEEEE-YYYYY-OOOOO
    for %%/ in (%KEY% %~n0 %*) do for /f "tokens=1-5 delims=-" %%a in ("%%/") do if "%%e" neq "" set "PKEY=%%/"
    if defined PKEY set "PKEY1=%PKEY:~-1%" & set "PKEY28=%PKEY:~28,1%"
    if defined EDITION if "%PKEY1%" equ "%PKEY28%" (set KEY=%PKEY%)
    if defined EDITION if "%PKEY1%" equ "%PKEY28%" set "KEY=%PKEY%"

    :: hint: if you want setup to run a tweaking script before first logon, save it at $OEM$\$$\Setup\Scripts\setupcomplete.cmd
    :: parse NO_UPDATE from script name or commandline - dont download and apply latest LCU on upgrade [more C:\ space and might fail]
    for %%/ in (%~n0 %*) do if /i %%/ equ no_update set "NO_UPDATE=1"
    if defined NO_UPDATE (set UPDATE=/DynamicUpdate Disable) else (set UPDATE=/DynamicUpdate Enable)

    :begin
    :: parse NO_UNDO from script name or commandline - dont create Windows.old undo data on upgrade [faster but less reliable]
    for %%/ in (%~n0 %*) do if /i %%/ equ no_undo set "NO_UNDO=1"

    :: show MCT choice dialog
    if not defined MCT call :choices MCT "%CHOICES%" 12 "MediaCreationTool" 11 white dodgerblue 360
    :: parse NO_OEM from script name or commandline - dont include $OEM$\ subfolder and auto.cmd in the created media
    for %%/ in (%~n0 %*) do if /i %%/ equ no_oem set "NO_OEM=1"
    :: hint: setup can run a tweaking script before first logon, if present at $OEM$\$$\Setup\Scripts\setupcomplete.cmd

    :: detect current os_arch, os_langcode, os_edition, os_product, os_version
    set "OS_ARCH=x64" & if "%PROCESSOR_ARCHITECTURE:~-2%" equ "86" if not defined PROCESSOR_ARCHITEW6432 set "OS_ARCH=x86"
    call :reg_query "HKU\S-1-5-18\Control Panel\Desktop\MuiCached" "MachinePreferredUILanguages" OS_LANGCODE
    for %%s in (%OS_LANGCODE%) do set "OS_LANGCODE=%%s"
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "EditionID" OS_EDITION
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName" OS_PRODUCT
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentBuildNumber" OS_VERSION
    for %%/ in (1507.10240 1511.10586 1607.14393 1703.15063 1709.16299 1803.17134 1809.17763 1903.18362 1909.18363 2004.19041
    2009.19042 2104.19043) do if .%OS_VERSION% equ %%~x/ set/a OS_VERSION=%%~n/

    :: show more responsive MCT + ACT pseudo-menu dialog or separate choice dialog instances if either MCT or ACT are set
    if "%MCT%;%ACT%"==";" call :choice.2x MCT "%VERSIONS%" 12 "MCT Version" ACT "%ACTIONS%" 2 "MCT Action" 11 white dodgerblue 360
    if %MCT%0 lss 1 if %ACT%0 gtr 1 call :choice MCT "%VERSIONS%" 12 "MCT Version" 11 white dodgerblue 360
    if %MCT%0 gtr 1 if %ACT%0 lss 1 call :choice ACT "%ACTIONS%" 2 "%VID% Action" 11 white dodgerblue 360
    if %MCT%0 gtr 1 if %ACT%0 lss 1 goto choice-0 = cancel
    goto choice-%MCT%

    :choice-12
    set "V=2104" & set "S=21H1" & set "B=19043.928.210409-1212.21h1_release_svc_refresh" & set "D=2021/04/" & set "C=1.4.1"
    set "VER=2104" & set "VID=21H1" & set "CB=19043.928.210409-1212.21h1_release_svc_refresh" & set "CD=2021/04/" & set "CC=1.4.1"
    set "CAB=%\\%download.microsoft.com/download/f/d/d/fddbe550-0dbf-44b4-9e60-6f0e73d654c0/products_20210415.cab"
    set "MCT=%\\%download.microsoft.com/download/d/5/2/d528a4e0-03f3-452d-a98e-3e479226d166/MediaCreationTool21H1.exe"
    set "EXE=%\\%download.microsoft.com/download/d/5/2/d528a4e0-03f3-452d-a98e-3e479226d166/MediaCreationTool21H1.exe"
    :: refreshed 19041 base with integrated 21H1 enablement package - release
    goto process

    :choice-11
    set "V=2009" & set "S=20H2" & set "B=19042.631.201119-0144.20h2_release_svc_refresh" & set "D=2020/11/" & set "C=1.4.1"
    set "VER=2009" & set "VID=20H2" & set "CB=19042.631.201119-0144.20h2_release_svc_refresh" & set "CD=2020/11/" & set "CC=1.4.1"
    set "CAB=%\\%download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=%\\%download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    set "EXE=%\\%download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    :: refreshed 19041 base with integrated 20H2 enablement package to mainly bundle ChrEdge
    goto process

    :choice-10
    set "V=2004" & set "S=20H1" & set "B=19041.508.200907-0256.vb_release_svc_refresh" & set "D=2020/09/" & set "C=1.4"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=19041.572.201009-1946.vb_release_svc_refresh" & set "D=2020/11/"
    set "VER=2004" & set "VID=20H1" & set "CB=19041.508.200907-0256.vb_release_svc_refresh" & set "CD=2020/09/" & set "CC=1.4"
    if %INSERT_BUSINESS%0 gtr 1 set "CB=19041.572.201009-1946.vb_release_svc_refresh" & set "CD=2020/11/"
    set "CAB=%\\%download.microsoft.com/download/7/4/4/744ccd60-3203-4eea-bfa2-4d04e18a1552/products.cab"
    set "MCT=%\\%software-download.microsoft.com/download/pr/8d71966f-05fd-4d64-900b-f49135257fa5/MediaCreationTool2004.exe"
    set "EXE=%\\%software-download.microsoft.com/download/pr/8d71966f-05fd-4d64-900b-f49135257fa5/MediaCreationTool2004.exe"
    :: visible improvements to windows update, defender, search, dx12, wsl, sandbox
    goto process

    :choice-9
    set "V=1909" & set "S=19H2" & set "B=18363.592.200109-2016.19h2_release_svc_refresh" & set "D=2020/01/" & set "C=1.3"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=18363.1139.201008-0514.19h2_release_svc_refresh" & set "D=2020/11/"
    set "VER=1909" & set "VID=19H2" & set "CB=18363.592.200109-2016.19h2_release_svc_refresh" & set "CD=2020/01/" & set "CC=1.3"
    if %INSERT_BUSINESS%0 gtr 1 set "CB=18363.1139.201008-0514.19h2_release_svc_refresh" & set "CD=2020/11/"
    set "CAB=%\\%download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=%\\%download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    set "EXE=%\\%download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    :: refreshed 18362 base with integrated 19H2 enablement package to activate usability and security fixes
    goto process

    :choice-8
    set "V=1903" & set "S=19H1" & set "B=18362.356.190909-1636.19h1_release_svc_refresh" & set "D=2019/09/" & set "C=1.3"
    set "VER=1903" & set "VID=19H1" & set "CB=18362.356.190909-1636.19h1_release_svc_refresh" & set "CD=2019/09/" & set "CC=1.3"
    set "CAB=%\\%download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=%\\%download.microsoft.com/download/9/8/8/9886d5ac-8d7c-4570-a3af-e887ce89cf65/MediaCreationTool1903.exe"
    set "EXE=%\\%download.microsoft.com/download/9/8/8/9886d5ac-8d7c-4570-a3af-e887ce89cf65/MediaCreationTool1903.exe"
    :: modern windows 10 starts here with proper memory allocation, cpu scheduling, security features
    goto process

    :choice-7
    set "V=1809" & set "S=1809" & set "B=17763.379.190312-0539.rs5_release_svc_refresh" & set "D=2019/03/" & set "C=1.3"
    set "VER=1809" & set "VID=1809" & set "CB=17763.379.190312-0539.rs5_release_svc_refresh" & set "CD=2019/03/" & set "CC=1.3"
    set "CAB=%\\%download.microsoft.com/download/8/E/8/8E852CBF-0BCC-454E-BDF5-60443569617C/products_20190314.cab"
    set "MCT=%\\%software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    set "EXE=%\\%software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    :: rather mediocre considering it is the base for ltsc 2019; less smooth than 1803 in games; intel pre-4th-gen still buggy
    goto process

    :choice-6
    set "V=1803" & set "S=1803" & set "B=17134.112.180619-1212.rs4_release_svc_refresh" & set "D=2018/07/" & set "C=1.2"
    set "VER=1803" & set "VID=1803" & set "CB=17134.112.180619-1212.rs4_release_svc_refresh" & set "CD=2018/07/" & set "CC=1.2"
    set "CAB=%\\%download.microsoft.com/download/5/C/B/5CB83D2A-2D7E-4129-9AFE-353F8459AA8B/products_20180705.cab"
    set "MCT=%\\%software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    set "EXE=%\\%software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    :: update available to finally fix most standby memory issues that were present since 1703; intel pre-4th-gen still buggy
    goto process

    :choice-5
    set "V=1709" & set "S=1709" & set "B=16299.125.171213-1220.rs3_release_svc_refresh" & set "D=2018/01/" & set "C=1.1"
    set "VER=1709" & set "VID=1709" & set "CB=16299.125.171213-1220.rs3_release_svc_refresh" & set "CD=2018/01/" & set "CC=1.1"
    set "CAB=%\\%download.microsoft.com/download/3/2/3/323D0F94-95D2-47DE-BB83-1D4AC3331190/products_20180105.cab"
    set "MCT=%\\%download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    set "EXE=%\\%download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    :: plagued by standby and other memory allocation bugs, fullscreen optimisation issues, worst version of windows 10 by far
    goto process

    :choice-4
    set "V=1703" & set "S=1703" & set "B=15063.0.170317-1834.rs2_release" & set "D=2017/03/" & set "C=1.0"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=15063.0.170710-1358.rs2_release_svc_refresh" & set "D=2017/07/"
    set "VER=1703" & set "VID=1703" & set "CB=15063.0.170317-1834.rs2_release" & set "CD=2017/03/" & set "CC=1.0"
    if %INSERT_BUSINESS%0 gtr 1 set "CB=15063.0.170710-1358.rs2_release_svc_refresh" & set "CD=2017/07/"
    rem set "XML=%\\%download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    rem above refreshed xml often fails decrypting dual x86 + x64 - using rtm instead; the added enterprise + cloud are refreshed
    set "CAB=%\\%download.microsoft.com/download/9/5/4/954415FD-D9D7-4E1F-8161-41B3A4E03D5E/products_20170317.cab"
    set "MCT=%\\%download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35B8FA35EC3F/MediaCreationTool.exe"
    set "EXE=%\\%download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35B8FA35EC3F/MediaCreationTool.exe"
    :: some gamers still find it the best despite unfixed memory allocation bugs and exposed cpu flaws; can select Cloud (S)
    goto process

    :choice-3
    set "V=1607" & set "S=1607" & set "B=14393.0.161119-1705.rs1_refresh" & set "D=2017/01/" & set "C=1.0"
    set "VER=1607" & set "VID=1607" & set "CB=14393.0.161119-1705.rs1_refresh" & set "CD=2017/01/" & set "CC=1.0"
    set "CAB=%\\%wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products_20170116.cab"
    set "MCT=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    set "EXE=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: snappy and stable for legacy hardware
    goto process

    :choice-2
    set "V=1511" & set "S=1511" & set "B=10586.0.160426-1409.th2_refresh" & set "D=2016/05/" & set "C=1.0"
    set "VER=1511" & set "VID=1511" & set "CB=10586.0.160426-1409.th2_refresh" & set "CD=2016/05/" & set "CC=1.0"
    set "XML=%\\%wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products05242016.xml"
    set "MCT=%\\%download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    set "EXE=%\\%download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    rem 1511 MCT exe works and can select Education - using 1607 one instead anyway for unified products.xml catalog 1.0 format
    set "MCT=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    set "EXE=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: most would rather go with 1507 or 1607 instead as with a little effort can apply latest ltsb updates on all editions
    goto process

    :choice-1
    set "V=1507" & set "S=1507" & set "B=10240.16393.150909-1450.th1_refresh" & set "D=2015/09/" & set "C=1.0"
    set "VER=1507" & set "VID=1507" & set "CB=10240.16393.150909-1450.th1_refresh" & set "CD=2015/09/" & set "CC=1.0"
    set "XML=%\\%wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products09232015_2.xml"
    set "MCT=%\\%download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationToolx64.exe"
    set "MCT32=%\\%download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationTool.exe"
    if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if not defined PROCESSOR_ARCHITEW6432 set "MCT=%MCT32%"
    set "EXE=%\\%download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationToolx64.exe"
    set "EXE32=%\\%download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationTool.exe"
    if /i "%PROCESSOR_ARCHITECTURE%" equ "x86" if not defined PROCESSOR_ARCHITEW6432 set "EXE=%EXE32%"
    rem 1507 MCT exe works but cant select Education - using 1607 one instead anyway for unified products.xml catalog 1.0 format
    set "MCT=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    set "EXE=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: fastest for potato PCs
    goto process

    :choice-
    :choice-0
    %<%:e1 " NO MCT SELECTED "%>% & popd & timeout /t 10 >nul & exit/b

    :choices dialog: 1=variable 2="c,h,o,i,c,e,s" 3=selected-index [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=winsize
    set "0=%~f0" &set 1=%*& powershell -nop -c "iex(([io.file]::ReadAllText($env:0)-split':PS_CHOICES\:.*')[1]+'Choices '+$env:1)">nul
    set "%~1=%errorlevel%" &exit/b &rem :PS_CHOICES: # USAGE: call :choices rez "one,2 two,three" 3 'some title' 16 white blue 200
    function Choices ($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc='MidnightBlue',$fc='Snow',[string]$min='300') {
    [void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $f=new-object System.Windows.Forms.Form; $i=1
    $global:rez=''; $bt=@(); $ch=($choices+',Cancel').split(','); $ch |foreach {$b=New-Object System.Windows.Forms.Button; $b.Name=$i
    $b.Text=$_; $b.Font='Tahoma,'+$sz; $b.Margin='0,0,9,9'; $b.Location='9,'+($sz*3*$i-$sz); $b.MinimumSize=$min+',18'; $b.AutoSize=1
    $b.FlatStyle=0; $b.cursor='Hand'; $b.add_Click({$global:rez=$this.Name;$f.Close()}); $f.Controls.Add($b); $bt+=$b; $i++}
    $f.Text=$caption; $f.BackColor=$bc; $f.ForeColor=$fc; $f.StartPosition=4; $f.AutoSize=1; $f.AutoSizeMode=0; $f.MaximizeBox=0
    $f.AcceptButton=$bt[$sel-1]; $f.CancelButton=$bt[-1]; $f.Add_Shown({$f.Activate();$bt[$sel-1].focus()}); $null=$f.ShowDialog()
    if ($global:rez -ne $ch.length) {exit $global:rez} else {exit 0} } :PS_CHOICES: gui choices returning index - snippet by AveYo

    :reg_query "HKCU\KeyName" "ValueName" Var
    (for /f "tokens=2*" %%R in ('reg query "%~1" /v "%~2" /se "," 2^>nul') do set "%~3=%%S") &exit/b

    :init script
    @echo off & title %1 & color 1f & mode 120,30 & (set __COMPAT_LAYER=Installer)
    %<%:e1 " CANCELED "%>% & popd & timeout /t 5 >nul & EXIT/B

    :start
    @echo off & title %~nx0 & color 1f & mode 120,30 & set "__COMPAT_LAYER=Installer"
    :: self-echo top 1-20 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,22) do set \=& set/p \=& call echo;%%\%%)
    :: lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    @@ -205,242 +225,366 @@ for %%s in (latest_MCT_script.url) do if not exist %%s (echo;[InternetShortcut]&
    :: baffling pastebin url filters..
    for %%s in (tp://) do set "\\=ht%%s"
    :: (un)define main variables
    set OPTIONS=/Selfhost& for %%v in (ACT DEFAULT AUTO ISO UPDATE EDITION KEY ARCH LANGCODE XML CAB MCT S) do (set %%v=)
    exit/b
    for %%v in (NO_UPDATE NO_OEM ACT AUTO CREATE ISO DEFAULT EDITION KEY ARCH LANGCODE VID MCT XML CAB EXE) do set "%%v="
    set OPTIONS=/Selfhost& exit/b
    :process

    :process MCT choice
    :: parse gui / cmdline action
    if %ACT% equ 1 set "ACTION=Auto Setup" & set "AUTO=1" & set "ISO=" & set "CREATE="
    if %ACT% equ 2 set "ACTION=Create ISO" & set "AUTO=" & set "ISO=1" & set "CREATE=1"
    if %ACT% equ 3 set "ACTION=Select in MCT" & for %%v in (CREATE AUTO ISO EDITION LANGCODE ARCH KEY) do set "%%v="

    :: show Auto-Upgrade (enhanced), Create-Media (enhanced) or Default (vanilla MCT) choice dialog
    if "%AUTO%%ISO%"=="" call :choices ACT "Default, Auto-Upgrade, Create-Media" 1 "%S% MediaCreationTool" 11 white dodgerblue 360
    if "%AUTO%%ISO%"=="" if %ACT%0==10 (set DEFAULT=1) else if %ACT%0==20 (set AUTO=1) else if %ACT%0==30 (set ISO=1)
    if "%AUTO%%ISO%"=="" if %ACT%0 lss 10 set MCT=& goto begin
    if defined AUTO (set ACTION=Auto-Upgrade) else if defined ISO (set ACTION=Create-Media) else (set ACTION=Default)

    :: detect current os_arch, os_langcode, os_edition, os_product, os_ver
    set OS_ARCH=x64& if "%PROCESSOR_ARCHITECTURE:~-2%"=="86" if not defined PROCESSOR_ARCHITEW6432 set OS_ARCH=x86
    call :reg_query "HKU\S-1-5-18\Control Panel\Desktop\MuiCached" "MachinePreferredUILanguages" OS_LANGCODE
    for %%s in (%OS_LANGCODE%) do (set OS_LANGCODE=%%s)
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "EditionID" OS_EDITION
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName" OS_PRODUCT
    for /f "tokens=4-5 delims=. " %%i in ('ver') do set/a OS_VER=%%i%%j

    :: upgrade fix for Windows Embedded / PosReady7 - override edition with Windows 10 Enterprise
    if /i "%OS_EDITION%" equ "Embedded" (set EDITION=Enterprise& set KEY=)

    :: preset generic key - only staged editions in MCT install.esd - see sources\product.ini
    if defined EDITION for %%/ in (%EDITION%) do for %%K in ( BT79Q-G7N6G-PGBYW-4YWX6-6F4BT.CoreSingleLanguage
    :: cleanup MCT workfolder / temporary ESD
    pushd "%~dp0" & mkdir MCT >nul 2>nul & pushd MCT
    del /f /q products.* 2>nul & set/a latest=0 & if exist latest set/p latest=<latest
    echo,20210621>latest & if %latest% lss 20210531 del /f /q products*.* MediaCreationTool*.exe 2>nul

    :: pre-run test of the built-in :DIR2ISO lean and mean snippet to automate iso creation, or fallback to manual selection in MCT
    if defined CREATE (mkdir test\iso & copy /y "%~f0" test\iso\tmp.txt & call :DIR2ISO "test" "test.iso") >nul 2>nul
    if defined CREATE for %%/ in (test.iso) do (rd/s/q test & del/f/q test.iso & if %%~z/0 lss 300000 set "CREATE=") >nul 2>nul
    set FREE=0& for /f %%s in ('powershell -nop -c "[Math]::Round((Get-PSDrive $pwd.Path[0]).Free/1073741824)"') do set "FREE=%%~s"
    if defined CREATE if %FREE% LSS 5 set CREATE=& %<%:1e "INFO: Run from a drive with 5GB+ free to create iso directly "%>% &echo;
    if defined ISO if not defined CREATE set/a ACT=3 & set "ACTION=Select in MCT"

    :: initial detected / selected media preset
    if defined EDITION (set MEDIA_EDITION=%EDITION%) else (set MEDIA_EDITION=%OS_EDITION%)
    if defined LANGCODE (set MEDIA_LANGCODE=%LANGCODE%) else (set MEDIA_LANGCODE=%OS_LANGCODE%)
    if defined ARCH (set MEDIA_ARCH=%ARCH%) else (set MEDIA_ARCH=%OS_ARCH%)

    :: edition fallback per MCT support
    set MEDIA_EDITION=%MEDIA_EDITION:Embedded=Enterprise%& set MEDIA_EDITION=%MEDIA_EDITION:EnterpriseS=Enterprise%& rem
    rem if defined CREATE (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalWorkstation=Enterprise%)
    rem if defined CREATE (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Education%)
    if %VER% leq 1709 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalWorkstation=Professional%)
    if %VER% leq 1709 (set MEDIA_EDITION=%MEDIA_EDITION:ProfessionalEducation=Professional%)
    if %VER% leq 1511 (set MEDIA_EDITION=%MEDIA_EDITION:Enterprise=Professional%)
    if %VER% leq 1703 if %INSERT_BUSINESS%0 lss 1 (set MEDIA_EDITION=%MEDIA_EDITION:Enterprise=Professional%)
    if %VER% leq 1511 if %UNHIDE_BUSINESS%0 lss 1 (set MEDIA_EDITION=%MEDIA_EDITION:Education=Professional%)

    :: generic key preset - only staged editions in MCT install.esd - see sources\product.ini
    for %%/ in (%MEDIA_EDITION%) do for %%K in (
    YTMG3-N6DKC-DKB77-7M9GH-8HVX7.Core 4CPRK-NM3K3-X6XXQ-RXX86-WXCHW.CoreN
    BT79Q-G7N6G-PGBYW-4YWX6-6F4BT.CoreSingleLanguage N2434-X9D7W-8PF6X-8DV9T-8TYMD.CoreCountrySpecific
    VK7JG-NPHTM-C97JM-9MPGT-3V66T.Professional 2B87N-8KFHP-DKV6R-Y2C8J-PKCKT.ProfessionalN
    8PTT6-RNW4C-6V7J2-C2D3X-MHBPB.ProfessionalEducation GJTYN-HDMQY-FRR76-HVGC7-QPF8P.ProfessionalEducationN
    DXG7C-N36C4-C4HTG-X4T3X-2YV77.ProfessionalWorkstation WYPNQ-8C467-V2W6J-TX4WX-WT2RQ.ProfessionalWorkstationN
    YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY.Education 84NGF-MHBT6-FXBX8-QWJK7-DRR8H.EducationN
    NPPR9-FWDCX-D2C8J-H872K-2YT43.Enterprise DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4.EnterpriseN
    ) do if /i %%~xK==.%%/ (set EDITION=%%~xK& call set EDITION=%%EDITION:.=%%& if not defined KEY set KEY=%%~nK)

    :: parse options to create iso / usb media with less prompts - also works in auto upgrade preset to switch target edition
    set MEDIA=& for %%s in (%LANGCODE%%EDITION%%ARCH%%KEY%) do (set MEDIA=%%s)
    if defined MEDIA if not defined LANGCODE set LANGCODE=%OS_LANGCODE%
    if defined MEDIA if not defined EDITION set EDITION=%OS_EDITION%
    if defined MEDIA if not defined ARCH set ARCH=%OS_ARCH%

    :: OPTIONS /MediaEdition /MediaLangCode /MediaArch are not supported in MCT versions before 1709
    if defined MEDIA for %%s in (%EDITION%) do (set OS_EDITION=%%s& if %V% geq 1709 set OPTIONS=%OPTIONS% /MediaEdition %%s)
    if defined MEDIA for %%s in (%LANGCODE%) do (set OS_LANGCODE=%%s& if %V% geq 1709 set OPTIONS=%OPTIONS% /MediaLangCode %%s)
    if defined MEDIA for %%s in (%ARCH%) do (set OS_ARCH=%%s& if %V% geq 1709 set OPTIONS=%OPTIONS% /MediaArch %%s)
    if %V% lss 1709 (set KEY=)

    :: show label
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %S% "%>>% & %<%:f1 " %B% "%>>%
    %<%:8f " %OS_LANGCODE% "%>>% & %<%:3f " %OS_EDITION% "%>>% & %<%:5f " %OS_ARCH% "%>>%
    ) do if /i %%~xK equ .%%/ set MEDIA_EDITION=%%~xK& call set MEDIA_EDITION=%%MEDIA_EDITION:.=%%& set "MEDIA_KEY=%%~nK"

    :: detected / selected media preset
    set MEDIA=& for %%s in (%EDITION%%LANGCODE%%ARCH%%KEY%) do (set MEDIA=%%s)
    if defined MEDIA for %%s in (%MEDIA_EDITION%) do (set EDITION=%%s)
    if defined MEDIA for %%s in (%MEDIA_LANGCODE%) do (set LANGCODE=%%s)
    if defined MEDIA for %%s in (%MEDIA_ARCH%) do (set ARCH=%%s)
    if defined MEDIA for %%s in (%MEDIA_KEY%) do (if not defined KEY set KEY=%MEDIA_KEY%)

    :: show media preset label
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %VID% "%>>% & %<%:f1 " %CB% "%>>%
    %<%:8f " %MEDIA_LANGCODE% "%>>% & %<%:3f " %MEDIA_EDITION% "%>>% & %<%:5f " %MEDIA_ARCH% "%>>%
    %<%:11 ~%>% & echo;

    :: cleanup MCT\ workfolder
    pushd "%~dp0" & mkdir MCT >nul 2>nul & pushd MCT
    del /f /q products.* 2>nul & set/a latest=0 & if exist latest set/p latest=<latest
    echo,20210523>latest & if %latest% LEQ 20210521 del /f /q products*.* MediaCreationTool*.exe 2>nul

    :: download MCT and CAB / XML
    set "DOWN=function dl($u,$f){$w=new-object System.Net.WebClient; $w.Headers.Add('user-agent','ipad'); try{$w.DownloadFile($u,$f)}"
    set "LOAD=catch [System.Net.WebException] {write-host -non ';('; del $f -force -ea 0} finally{$w.Dispose()} } ; dl"
    if defined MCT echo;%MCT%
    if not exist MediaCreationTool%V%.exe powershell -nop -c "%DOWN% %LOAD% $env:MCT 'MediaCreationTool%V%.exe'" 2>nul
    if not exist MediaCreationTool%V%.exe %<%:1e " MediaCreationTool%V%.exe download failed "%>%
    set "DOWN=function dl($u,$f){$w=new-object Net.WebClient; $w.Headers.Add('user-agent','ipad'); try{$w.DownloadFile($u,$f)}"
    set "LOAD=catch [Net.WebException] {write-host -non ';('; del $f -force -ea 0} finally{$w.Dispose()} } ; dl"
    if defined EXE echo;%EXE%
    if not exist MediaCreationTool%VER%.exe powershell -nop -c "%DOWN% %LOAD% $env:EXE 'MediaCreationTool%VER%.exe'" 2>nul
    if not exist MediaCreationTool%VER%.exe %<%:1e " MediaCreationTool%VER%.exe download failed "%>%
    if defined XML echo;%XML%
    if defined XML if not exist products%V%.xml powershell -nop -c "%DOWN% %LOAD% $env:XML 'products%V%.xml'" 2>nul
    if defined XML if not exist products%V%.xml %<%:1e " products%V%.xml download failed "%>%
    if defined XML if exist products%V%.xml copy /y products%V%.xml products.xml >nul 2>nul
    if defined XML if not exist products%VER%.xml powershell -nop -c "%DOWN% %LOAD% $env:XML 'products%VER%.xml'" 2>nul
    if defined XML if not exist products%VER%.xml %<%:1e " products%VER%.xml download failed "%>%
    if defined XML if exist products%VER%.xml copy /y products%VER%.xml products.xml >nul 2>nul
    if defined CAB echo;%CAB%
    if defined CAB if not exist products%V%.cab powershell -nop -c "%DOWN% %LOAD% $env:CAB 'products%V%.cab'" 2>nul
    if defined CAB if not exist products%V%.cab %<%:1e " products%V%.cab download failed "%>%
    if exist products%V%.cab del /f /q products%V%.xml 2>nul
    if exist products%V%.cab expand.exe -R products%V%.cab -F:* . >nul 2>nul
    echo; & set "err=" & for %%s in (products.xml MediaCreationTool%V%.exe) do if not exist %%s set err=1
    if defined CAB if not exist products%VER%.cab powershell -nop -c "%DOWN% %LOAD% $env:CAB 'products%VER%.cab'" 2>nul
    if defined CAB if not exist products%VER%.cab %<%:1e " products%VER%.cab download failed "%>%
    if exist products%VER%.cab del /f /q products%VER%.xml 2>nul
    if exist products%VER%.cab expand.exe -R products%VER%.cab -F:* . >nul 2>nul
    echo; & set "err=" & for %%s in (products.xml MediaCreationTool%VER%.exe) do if not exist %%s set err=1
    if defined err %<%:4f " ERROR "%>>% & %<%:0f " Check urls in browser | del MCT dir | unblock powershell | enable BITS serv "%>%
    if defined err del /f /q products%V%.* MediaCreationTool%V%.exe 2>nul &pause &exit/b
    if not defined err %<%:0f " MCT %ACTION% starts after configuring products.xml, please wait..."%>%

    :: configure products.xml - editing in one go via powershell snippet
    set "0=%~f0" & powershell -nop -c $f0=[io.file]::ReadAllText($env:0);iex(($f0-split':PRODUCTS_XML\:.*')[1]) & goto :PRODUCTS_XML:
    [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",[Text.Encoding]::UTF8)
    $ver = $env:V; $vers = $env:S; ${\\}='ht'+'tp://' # baffling pastebin url filters..

    ## apply/insert Catalog version attribute for MCT compatibility
    if ($null -ne $xml.MCT) {
    $xml.MCT.Catalogs.Catalog.version = $env:C; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    } else { if ($ver -eq 1703 -and $env:XML) {$root = $xml.SelectSingleNode('/PublishedMedia');continue}
    $temp = [xml]('<?xml version="1.0" encoding="UTF-8"?><MCT><Catalogs><Catalog version="' + $env:C + '"/></Catalogs></MCT>')
    $null = $temp.SelectSingleNode('/MCT/Catalogs/Catalog').AppendChild($temp.ImportNode($xml.PublishedMedia,$true))
    $xml = $temp; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    }

    ## apply/insert EULA url fix to prevent MCT timing out while downloading it (likely TLS issue under naked Windows 7 host)
    $eula = "${\\}download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9/EULA_MCTool_";$rtf='_6.27.16.rtf'
    if ($null -ne $root.EULAS) {
    foreach ($i in $root.EULAS.EULA) {$i.URL = $eula + $i.LanguageCode.ToUpper() + $rtf}
    } else {
    $tmp = [xml]('<EULA><LanguageCode/><URL/></EULA>'); $el = $xml.CreateElement('EULAS'); $node = $xml.ImportNode($tmp.EULA,$true)
    foreach ($lang in ($root.Languages.Language |where {$_.LanguageCode -ne 'default'})) {
    $i = $el.AppendChild($node.Clone()); $lc = $lang.LanguageCode; $i.LanguageCode = $lc; $i.URL = $eula + $lc.ToUpper() + $rtf
    }
    $null = $root.AppendChild($el)
    }

    ## friendlier version + combined consumer editions label (not doing it for business too here as it would be ignored by mct)
    if ($null -ne $root.Languages) {
    if ($ver -gt 1511) {$CONSUMER = "$vers Home | Pro | Edu"} else {$CONSUMER = "$vers Home | Pro"}
    foreach ($i in $root.Languages.Language) {
    foreach ($l in $i.ChildNodes) {$label = $i.$($l.LocalName); $i.$($l.LocalName) = $label.replace("Windows 10", "$vers")}
    if ($null -ne $i.CLIENT) {$i.CLIENT = "$CONSUMER"} ; if ($null -ne $i.CLIENT_K) {$i.CLIENT_K = "$CONSUMER K"}
    if ($null -ne $i.CLIENT_N) {$i.CLIENT_N = "$CONSUMER N"} ; if ($null -ne $i.CLIENT_KN) {$i.CLIENT_KN = "$CONSUMER KN"}
    }
    }

    ## unhide combined business editions in xml that include them: 1709 - 20H2; unhide Education on 1507 - 1511; better edition label
    if ($env:UNHIDE_BUSINESS -ge 1) {
    if ($ver -gt 1511) {$CONSUMER = 'Home | Pro | Edu'} else {$CONSUMER = 'Home | Pro'}
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64') {continue} ; $edi = $f.Edition; $loc = $f.Edition_Loc
    if ($edi -eq 'Enterprise') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = "$vers Enterprise | Pro vl | Edu vl"}
    if ($ver -le 1511 -and ($edi -eq 'Education' -or $edi -eq 'EducationN')) {$f.IsRetailOnly = 'False'}
    }
    }

    ## insert individual business editions in xml that never included them: 1607, 1703
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = "${\\}fg.ds.b1.download.windowsupdate.com/"
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2104,2004,1909,1703,1607,1511 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';pro='Professional';prN='ProfessionalN';edu='Education';edN='EducationN';
    clo='Cloud';clN='CloudN'}
    ## insert business entries for 1607, 1703
    if ($ver -le 1703) {
    $files = $root.Files.File |where {$_.Edition -eq "Education" -and $_.Architecture -ne 'ARM64'}
    foreach ($e in 'ent','enN','pro','prN','edu','edN','clo','clN') {
    $items = $csv |where {$_.Client -eq $e} |group Lang -AsHashTable -AsString; if ($null -eq $items) {continue}
    $cli = '_CLIENT' + $edi[$e]; $up = '/upgr/'; if ($ver -eq 1607 -and $e -like 'en*') {$up = '/updt/'} #.toupper();
    if ($e -like 'cl*') {$cli += '_RET_'} elseif ($e -like 'p*') {$cli += 'VL_VOL_'} else {$cli += '_VOL_'}
    if ($e -like 'cl*') {$BUSINESS = $edi[$e] -replace 'Cloud','S'} else {$BUSINESS = $edi[$e] -creplace 'N',' N'}
    foreach ($f in $files) {
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items[$lang]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly = 'False'; $c.Edition = $edi[$e]
    $name = $env:B + $cli + $arch + 'FRE_' + $lang; $c.Size = $i[0]; $c.Sha1 = $i[1]
    $c.FileName = $name + '.esd'; $c.FilePath = $url + $i[2] + $up + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    $c.Edition_Loc = "$vers $BUSINESS"
    $null = $root.Files.AppendChild($c)
    }
    }
    }
    ## update existing entries for 1909, 2004; add pre-release 2104 entries
    if ($ver -gt 1703) {
    $items = $csv |group Client,Lang -AsHashTable -AsString
    if ($null -ne $items) {
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64' -or $f.Edition_Loc -eq '%BASE_CHINA%') {continue}
    $cli = '_CLIENTCONSUMER_'; $chan = 'ret'; if ($f.Edition -like 'Enterprise*') {$cli= '_CLIENTBUSINESS_'; $chan = 'vol'}
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items["$chan, $lang"]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $name = $env:B + $cli + $chan.ToUpper() + '_' + $arch + 'FRE_' + $f.LanguageCode; $f.Size = $i[0]; $f.Sha1 = $i[1]
    $f.FileName = $name + '.esd'; $f.FilePath = $url + $i[2] + '/upgr/' + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    }
    }
    }
    }
    $xml.Save("$pwd\products.xml")
    :PRODUCTS_XML: edited!
    if defined err del /f /q products%VER%.* MediaCreationTool%VER%.exe 2>nul & pause & EXIT/B
    if not defined err %<%:0f " %ACTION% "%>% . . .

    :: configure products.xml in one go via powershell snippet
    call :PRODUCTS_XML

    :: repack XML into CAB
    makecab products.xml products.cab >nul

    :: add a short delay to see the script output since the xml processing is too fast :D
    timeout 5 >nul
    :: pause couple seconds before launching MCT directly / via powershell runas admin
    timeout /t 5 >nul

    :: Default action = just launch MCT executable with OPTIONS and close script without further enhancements
    if defined DEFAULT start MediaCreationTool%V%.exe %OPTIONS% &exit/b
    :: ===================================================================================================
    :: "Auto Setup" : after MCT authors sources, script starts auto.cmd setup (setupprep with OPTIONS)
    :: "Create ISO" : after MCT authors sources, script creates iso via built-in :DIR2ISO snippet
    :: "Select in MCT" : script just provides products.xml and OPTIONS to MCT for processing, then quits
    :: ===================================================================================================
    if "Select in MCT" equ "%ACTION%" (start MediaCreationTool%VER%.exe %OPTIONS%& EXIT/B)

    :: -------------------------------------------------------------------------------------------------------------------------------
    set OPTIONS=%OPTIONS% /Eula Accept /SkipSummary& set "LABEL=%VID%" & set "DIR=%SystemDrive%\ESD\Windows"
    for %%s in (%EDITION% %LANGCODE% %ARCH%) do call set "LABEL=%%LABEL%% %%s"
    (if %OS_VERSION% geq 2600 set "NO_UNDO=") & rem if %VER% gtr 1703 set OPTIONS=%OPTIONS% /Priority High
    set ACTION=/Action CreateUpgradeMedia /UpdateMedia Accept %UPDATE% %NO_UNDO% /MediaPath %SystemDrive%\ESD\Windows

    :: hint: if you want setup to run a tweaking script before first logon, save it at $OEM$\$$\Setup\Scripts\setupcomplete.cmd
    :: not using /MediaEdition setup option in MCT version 1703 and older - handled via products.xml
    if defined MEDIA for %%s in (%EDITION%) do if %VER% gtr 1703 (set OPTIONS=%OPTIONS% /MediaEdition %%s)
    if defined MEDIA for %%s in (%LANGCODE%) do if %VER% gtr 1703 (set OPTIONS=%OPTIONS% /MediaLangCode %%s)
    if defined MEDIA for %%s in (%ARCH%) do if %VER% gtr 1703 (set OPTIONS=%OPTIONS% /MediaArch %%s)

    :: generate sources\PID.txt to preset EDITION on boot media - MCT install.esd indexes only, ProWS/ProEdu auto upgrade ONLY
    if not defined AUTO for %%/ in (Workstation WorkstationN Education EducationN) do if "Professional%%/"=="%EDITION%" (set KEY=)
    if not defined KEY (del /f /q PID.txt 2>nul) else >PID.txt echo [PID]& for %%s in (%KEY%) do (>>PID.txt echo Value=%%s)
    if not defined AUTO for %%/ in (Workstation WorkstationN Education EducationN) do if "Professional%%/" equ "%EDITION%" set "KEY="
    if not defined KEY (del /f /q PID.txt 2>nul) else (echo;[PID]& echo;Value=%KEY%& echo;;Edition=%EDITION%) >PID.txt

    :: generate ISO\auto.cmd for auto upgrade 2nd stage - more reliably pass OPTIONS via setupprep
    >auto.cmd echo @echo off ^& rem MediaCreationTool.bat: auto upgrade Windows 10 with troubleshooting options and less prompts
    :: generate auto.cmd for auto upgrade 2nd stage - more reliably pass OPTIONS via setupprep and workaround to keep files and apps
    >auto.cmd echo;@echo off ^& title MediaCreationTool.bat: auto upgrade Windows 10 directly with suitable options
    >>auto.cmd echo;
    >>auto.cmd echo set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow
    >>auto.cmd echo;set "MediaBuildNumber=%VER%" ^& set "MediaEdition=%EDITION%" ^& set "dir=" ^& pushd "%%~dp0"
    >>auto.cmd echo;for %%%%i in ("x86\" "x64\" "") do if exist "%%%%~isources\setupprep.exe" set "dir=%%%%~i"
    >>auto.cmd echo;pushd "%%dir%%sources" ^|^| (pause ^& exit/b)
    >>auto.cmd echo;set MediaEdition ^|^| goto upgrade
    >>auto.cmd echo;
    >>auto.cmd echo set F=^&for %%%%i in ("%%~dp0x86\" "%%~dp0x64\" "%%~dp0") do if exist "%%%%~isources\setupprep.exe" set "F=%%%%~i"
    >>auto.cmd echo if not defined F echo [ERROR] ISO sources folder not found ^& timeout -1 ^&exit/b
    >>auto.cmd echo;:: cross-edition in-place / upgrade / downgrade check
    >>auto.cmd echo;set CV64="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    >>auto.cmd echo;set CV32="HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion"
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v EditionID 2^^^>nul') do set "EditionID=%%%%S"
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v ProductName 2^^^>nul') do set "ProductName=%%%%S"
    >>auto.cmd echo;for /f "tokens=2*" %%%%R in ('reg query %%CV64%% /v CurrentBuildNumber 2^^^>nul') do set "BuildNumber=%%%%S"
    >>auto.cmd echo;for %%%%/ in (1507.10240 1511.10586 1607.14393 1703.15063 1709.16299 1803.17134 1809.17763 1903.18362 1909.18363
    >>auto.cmd echo;2004.19041 2009.19042 2104.19043) do if .%%Version%% equ %%%%~x/ set/a Version=%%%%~n/
    >>auto.cmd echo;if "%%BuildNumber%%" gtr "2600" goto upgrade
    rem >>auto.cmd echo;if "%%BuildNumber%%" gtr "2600" if /i "%%EditionID%%" neq "Embedded" goto upgrade
    >>auto.cmd echo;if "%%BuildNumber%%" gtr "%%MediaBuildNumber%%" if "%%MediaBuildNumber%%" lss "2004" goto upgrade
    >>auto.cmd echo;if /i "%%EditionID%%" equ "%%MediaEdition%%" goto upgrade
    >>auto.cmd echo;fltmc^>nul ^|^| (echo EditionID=%%EditionID%% [MISMATCH] - Run as administrator to bypass ^& timeout /t 10)
    >>auto.cmd echo;
    >>auto.cmd echo :: cross-edition upgrade check
    >>auto.cmd echo set MediaEdition=^&set ME=%%OPTIONS:*/MediaEdition =%%
    >>auto.cmd echo if "%%ME%%" neq "%%OPTIONS%%" for /f %%%%i in ("%%ME%%") do set "MediaEdition=%%%%i"
    >>auto.cmd echo if not defined MediaEdition goto upgrade
    >>auto.cmd echo set cv="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    >>auto.cmd echo for /f "tokens=2*" %%%%R in ('reg query %%cv%% /v EditionID 2^^^>nul') do set "EditionID=%%%%S"
    >>auto.cmd echo for /f "tokens=2*" %%%%R in ('reg query %%cv%% /v ProductName 2^^^>nul') do set "ProductName=%%%%S"
    >>auto.cmd echo for /f "tokens=4-5 delims=. " %%%%i in ('ver') do set/a OS_VER=%%%%i%%%%j
    >>auto.cmd echo if %%OS_VER%% LSS 100 if /i "%%EditionID%%-%%MediaEdition%%" neq "Embedded-Enterprise" goto upgrade
    >>auto.cmd echo if /i "%%MediaEdition%%" equ "%%EditionID%%" goto upgrade
    >>auto.cmd echo fltmc^>nul ^|^| (echo [WARNING] MediaEdition mismatch - Run as administrator to bypass ^&timeout /t 10)
    >>auto.cmd echo;:: cross-edition in-place / upgrade workaround to keep files and apps - 20H1/20H2/21H1 also supports downgrade
    >>auto.cmd echo;(reg query %%CV64%% /v ProductName_UNDO ^|^| reg add %%CV64%% /v ProductName_UNDO /d "%%ProductName%%" /f
    >>auto.cmd echo; reg query %%CV64%% /v EditionID_UNDO ^|^| reg add %%CV64%% /v EditionID_UNDO /d "%%EditionID%%" /f
    >>auto.cmd echo; reg add %%CV64%% /v EditionID /d "%%MediaEdition%%" /f ^& reg delete %%CV64%% /v ProductName /f
    >>auto.cmd echo; reg query %%CV32%% /v EditionID ^&^& (
    >>auto.cmd echo; reg query %%CV32%% /v ProductName_UNDO ^|^| reg add %%CV32%% /v ProductName_UNDO /d "%%ProductName%%" /f
    >>auto.cmd echo; reg query %%CV32%% /v EditionID_UNDO ^|^| reg add %%CV32%% /v EditionID_UNDO /d "%%EditionID%%" /f
    >>auto.cmd echo; reg add %%CV32%% /v EditionID /d "%%MediaEdition%%" /f ^& reg delete %%CV32%% /v ProductName /f
    >>auto.cmd echo;)) ^>nul 2^>nul
    >>auto.cmd echo;
    >>auto.cmd echo :: cross-edition upgrade workaround
    >>auto.cmd echo reg add %%cv%% /v EditionID /d "%%MediaEdition%%" /f ^& reg delete %%cv%% /v ProductName /f
    >>auto.cmd echo reg add %%cv%% /v EditionID_undo_rename /d "%%EditionID%%" /f
    >>auto.cmd echo reg add %%cv%% /v ProductName_undo_delete /d "%%ProductName%%" /f
    >>auto.cmd echo :upgrade
    >>auto.cmd echo start "w" "%%F%%sources\setupprep.exe" %%OPTIONS%%

    :: pass auto upgrade 1st stage or create media as MCT setup action and set the working folder
    if 1%AUTO% gtr 10 set OPTIONS=%OPTIONS% /Eula Accept /Action CreateUpgradeMedia &set "ISO=%SystemDrive%\ESD\Windows"
    if 1%AUTO% leq 10 set OPTIONS=%OPTIONS% /Eula Accept /Action CreateMedia &set "ISO=%SystemDrive%\$Windows.~WS\Sources\Windows"

    :: finally, run MCT with OPTIONS, wait for sources folder creation, then import auto.cmd and/or PID.txt and/or $OEM$
    set "run=%~dp0MCT\run"
    >run echo $ISO='%ISO:'=''%'; cd -Lit(split-path '%run:'=''%')
    ::>>run echo ri $($env:SystemDrive+'\$Windows.~WS'),$($env:SystemDrive+'\$WINDOWS.~BT') -recurse -force -ea 0
    >>run echo $MCT=start MediaCreationTool%V%.exe '%OPTIONS:'=''%' -passthru; if ($null -eq $MCT) {return}
    >>run echo "$ISO\x64\sources","$ISO\sources" ^|%% {ri "$_\setup.exe" -force -ea 0}
    >>run echo for (;;) {
    >>run echo sleep 20; if ((gwmi -Class Win32_Process -Filter 'Name="MediaCreationTool%V%.exe"').ProcessId -le 0) {break}
    if not defined AUTO >>run echo "$ISO\x64\sources","$ISO\sources" ^|%% {if (Test-Path "$_\setup.exe") {break}}
    >>run echo }
    >>run echo "$ISO\x86\sources","$ISO\x64\sources","$ISO\sources" ^|%% {
    >>run echo if ((Test-Path "$_\setupprep.exe")-and(Test-Path "PID.txt")) {copy -Path "PID.txt" -Dest $_ -force}
    >>run echo if ((Test-Path "$_\setupprep.exe")-and(Test-Path '..\$OEM$')) {xcopy /CYBERHIQ '..\$OEM$' $($_+'\$OEM$')}
    >>run echo }
    >>run echo if (Test-Path "$ISO\setup.exe") {copy -Path "auto.cmd" -Dest $ISO -force}
    if defined AUTO >>run echo if (Test-Path "$ISO\auto.cmd") {start "$ISO\auto.cmd"}
    powershell -c start powershell \"" -win 1 -c iex([io.file]::ReadAllText('%run:'=''%')); \"" -verb runas &exit/b

    exit || DONE! AveYo: can skip some or all entries below if not interested in updating the esd links in products.xml

    :: Insert business esd links in 1511,1607,1703; UPDATE 1909 and 2004 by hand until getting a products.xml url from microsoft
    >>auto.cmd echo;:upgrade
    >>auto.cmd echo;start "auto" setupprep.exe %OPTIONS% %UPDATE% %NO_UNDO% /MigChoice Upgrade /Auto Upgrade

    :: run MCT /Action CreateUpgradeMedia with edition, then include auto.cmd / PID.txt / $OEM$ and start auto.cmd (if needed)
    set "mct=%__cd__:'=''%mct.ps1"
    >mct.ps1 echo;cd -Lit(split-path '%mct%'); $AUTO='%AUTO%'-ne''; $OEM='%NO_OEM%'-eq''
    >>mct.ps1 echo;$DIR='%DIR:'=''%'; cmd "/c del /f/q $DIR & rd /s/q $DIR"
    >>mct.ps1 echo;
    >>mct.ps1 echo;$CV64='HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
    >>mct.ps1 echo;$CV32='HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion'
    >>mct.ps1 echo;if (%VER% -le 1703 -and '%EDITION%'-ne'') {
    >>mct.ps1 echo; sp $CV64 EditionID "%EDITION%" -force; rp $CV64 ProductName -force
    >>mct.ps1 echo; if (test-path $CV32) {sp $CV32 EditionID "%EDITION%" -force; rp $CV32 ProductName -force}
    >>mct.ps1 echo;}
    >>mct.ps1 echo;
    >>mct.ps1 echo;$MCT=start -wait MediaCreationTool%VER%.exe '%OPTIONS:'=''% %ACTION:'=''%'
    >>mct.ps1 echo;
    >>mct.ps1 echo;"$DIR\x86\sources","$DIR\x64\sources","$DIR\sources" ^|%% {
    >>mct.ps1 echo; if (Test-Path "$_\setupprep.exe") {
    >>mct.ps1 echo; if (Test-Path "PID.txt") {copy -Path "PID.txt" -Dest $_ -force}
    >>mct.ps1 echo; if ($OEM -and (Test-Path '..\$OEM$')) {xcopy /CYBERHIQ '..\$OEM$' $($_+'\$OEM$')}
    >>mct.ps1 echo; }
    >>mct.ps1 echo;}
    >>mct.ps1 echo;if (%VER% -le 1703 -and '%EDITION%'-ne'') {
    >>mct.ps1 echo; sp $CV64 EditionID "%OS_EDITION%" -force; sp $CV64 ProductName "%OS_PRODUCT%" -force
    >>mct.ps1 echo; if (test-path $CV32) {sp $CV32 EditionID "%OS_EDITION%" -force; sp $CV32 ProductName "%OS_PRODUCT%" -force}
    >>mct.ps1 echo;}
    >>mct.ps1 echo;if ($OEM) {copy "auto.cmd" "$DIR\auto.cmd" -force}
    >>mct.ps1 echo;if ($AUTO) {start "auto.cmd" -WorkingDirectory $DIR}
    powershell -win 1 -nop -c start -wait -verb runas powershell \""-win 1 -nop -c iex([io.file]::ReadAllText('%mct%'))\"" 2>nul
    if defined AUTO (EXIT/B) else if not defined CREATE (EXIT/B) else (dir /b /s "%DIR%\*setupprep.exe" >nul 2>nul || EXIT/B)
    powershell -win 0 -nop -c ";"

    :: Create-ISO action via :DIR2ISO lean and mean snippet - only in automation scenario with "iso" argument set / parsed
    call :DIR2ISO -dir "%DIR%" -iso "..\%LABEL%.iso"
    if not errorlevel 1 rd /s/q "%DIR%" 2>nul
    timeout /t 5 >nul

    EXIT/B "ALL DONE!"
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    :reg_query [USAGE] call :reg_query "HKCU\Volatile Environment" Value variable
    (for /f "tokens=2*" %%R in ('reg query "%~1" /v "%~2" /se "," 2^>nul') do set "%~3=%%S")& exit/b


    $:DIR2ISO: #,# [PARAMS] directory file.iso
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=& set "0=%~f0"& set 1=%*& powershell -nop -c %#%& exit/b %errorcode%
    function :DIR2ISO ($dir, $iso) { if (!(test-path -Path $dir -pathtype Container)) {"[ERR] $dir\ :DIR2ISO";exit 1}; $dir2iso=@"
    using System; using System.IO; using System.Runtime.Interop`Services; using System.Runtime.Interop`Services.ComTypes;
    public class dir2iso {public int AveYo=2021; [Dll`Import("shlwapi",CharSet=CharSet.Unicode,PreserveSig=false)]
    internal static extern void SHCreateStreamOnFileEx(string f,uint m,uint d,bool b,IStream r,out IStream s);
    public static void Create(string file, ref object obj, int bs, int tb) { IStream dir=(IStream)obj, iso;
    try {SHCreateStreamOnFileEx(file,0x1001,0x80,true,null,out iso);} catch(Exception e) {Console.WriteLine(e.Message); return;}
    int d=tb>1024 ? 1024 : 1, pad=tb%d, block=bs*d, total=(tb-pad)/d, c=total>100 ? total/100 : total, i=1, MB=(bs/1024)*tb/1024;
    Console.Write("{0,3}% {1}MB {2} :DIR2ISO",0,MB,file); if (pad > 0) dir.CopyTo(iso, pad * block, Int`Ptr.Zero, Int`Ptr.Zero);
    while (total-- > 0) {dir.CopyTo(iso, block, Int`Ptr.Zero, Int`Ptr.Zero); if (total % c == 0) {Console.Write("\r{0,3}%",i++);}}
    iso.Commit(0); Console.WriteLine("\r{0,3}% {1}MB {2} :DIR2ISO", 100, MB, file); } }
    "@; & { $cs=new-object CodeDom.Compiler.CompilerParameters; $cs.GenerateInMemory=1 #,# no`warnings
    $compile=(new-object Microsoft.CSharp.CSharpCodeProvider).CompileAssemblyFromSource($cs, $dir2iso)
    $BOOT=@(); $bootable=0; $mbr_efi=@(0,0xEF); $images=@('boot\etfsboot.com','efi\microsoft\boot\efisys.bin') #,# efisys_noprompt
    0,1|% { $bootimage=join-path $dir -child $images[$_]; if (test-path -Path $bootimage -pathtype Leaf) {
    $bin=new-object -ComObject ADODB.Stream; $bin.Open(); $bin.Type=1; $bin.LoadFromFile($bootimage)
    $opt=new-object -ComObject IMAPI2FS.BootOptions; $opt.AssignBootImage($bin.psobject.BaseObject); $opt.Manufacturer='Microsoft'
    $opt.PlatformId=$mbr_efi[$_]; $opt.Emulation=0; $bootable=1; $BOOT += $opt.psobject.BaseObject } }
    $fsi=new-object -ComObject IMAPI2FS.MsftFileSystemImage; $fsi.FileSystemsToCreate=4; $fsi.FreeMediaBlocks=0
    if ($bootable) {$fsi.BootImageOptionsArray=$BOOT}; $CONTENT=$fsi.Root; $CONTENT.AddTree($dir,$false); $fsi.VolumeName='DVD_ROM'
    $obj=$fsi.CreateResultImage(); [dir2iso]::Create($iso,[ref]$obj.ImageStream,$obj.BlockSize,$obj.TotalBlocks) };[GC]::Collect()
    } $:DIR2ISO: #,# export directory as (bootable) udf iso - lean and mean snippet by AveYo, 2021


    $:CHOICE: #,# [PARAMS] indexvar "c,h,o,i,c,e,s" [OPTIONAL] default-index "title" fontsize backcolor forecolor winsize
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=& set "0=%~f0"& set 1=%*& (for /f "usebackq" %%/ in (`powershell -nop -c %#%`) do set "%1=%%/")& exit/bat/ps1
    function :CHOICE ($index,$choices,$def=1,$title='Choices',[int]$sz=12,$bc='MidnightBlue',$fc='Snow',[string]$win='300') {
    [void][Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $f=new-object Windows.Forms.Form; $global:ret=''
    $bt=@(); $i=1; $ch=($choices+',Cancel').split(','); $ch |foreach {$b=New-Object Windows.Forms.Button; $b.Font='Tahoma,'+$sz
    $b.Name=$i; $b.Text=$_; $b.Margin='0,0,9,9'; $b.Location='9,'+($sz*3*$i-$sz); $b.MinimumSize=$win+',18'; $b.AutoSize=1
    $b.add_GotFocus({$this.BackColor=$fc; $this.ForeColor=$bc}); $b.add_LostFocus({$this.BackColor=$bc; $this.ForeColor=$fc})
    $b.FlatStyle=0; $b.Cursor='Hand'; $b.add_Click({$global:ret=$this.Name;$f.Close()}); $f.Controls.Add($b); $bt+=$b; $i++}
    $f.Text=$title; $f.BackColor=$bc; $f.ForeColor=$fc; $f.StartPosition=4; $f.AutoSize=1; $f.AutoSizeMode=0; $f.MaximizeBox=0
    $f.AcceptButton=$bt[$def-1]; $f.CancelButton=$bt[-1]; $f.Add_Shown({$f.Activate();$bt[$def-1].focus()})
    $null=$f.ShowDialog(); $index=$global:ret; if ($index -eq $ch.length) {return 0} else {return $index}
    } $:CHOICE: #,# gui dialog with inverted focus returning selected index - lean and mean snippet by AveYo, 2018 - 2021


    $:CHOICE.2x: #,# [INTERNAL]
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=&set "0=%~f0"&set 1=%*&(for /f "tokens=1,2 usebackq" %%i in (`powershell -nop -c %#%`) do set %1=%%i&set %5=%%j)& exit/b
    function :CHOICE.2x { if (!(get-command :CHOICE -ea 0)) {iex($f0-split'\$\:CHOICE\:.*')[1]}; function :LOOP { $a=$args
    $c1 = @($a[0], $a[1], $a[2], $a[3], $a[-4], $a[-3], $a[-2], $a[-1]); $1= :CHOICE @c1; if ($1 -lt 1) {return "0 0"}
    $c2 = @($a[4], $a[5], $a[6], $a[7], $a[-4], $a[-3], $a[-2], $a[-1]); $2= :CHOICE @c2; if ($2 -ge 1) {return "$1 $2"}
    if ($2 -lt 1) {$a[2]=$1; :LOOP @a} }; :LOOP @args #,# index1 choices1 def1 title1 index2 choices2 def2 title2 font bc tc win
    } $:CHOICE.2x: #,# MediaCreationTool.bat gui pseudo-menu via :CHOICE snippet, streamlined in a single powershell instance


    $:PRODUCTS_XML: #,# [INTERNAL]
    set ^ #="$f0=[io.file]::ReadAllText($env:0);$0=($f0-split'\$%0:.*')[1];$1=$env:1-replace'([`@$])','`$1';iex(\"$0 `r`n %0 $1\")"
    set ^ #=& set "0=%~f0"& set 1=%*& powershell -nop -c %#%& exit/bat/ps1
    function :PRODUCTS_XML { [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",[Text.Encoding]::UTF8)
    $ver = $env:VER; $vid = $env:VID; ${\\}='ht'+'tp://'; $url = "${\\}fg.ds.b1.download.windowsupdate.com/"
    #,# apply/insert Catalog version attribute for MCT compatibility
    if ($null -ne $xml.MCT) {
    $xml.MCT.Catalogs.Catalog.version = $env:CC; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    } else {
    $temp = [xml]('<?xml version="1.0" encoding="UTF-8"?><MCT><Catalogs><Catalog version="' + $env:CC + '"/></Catalogs></MCT>')
    $null = $temp.SelectSingleNode('/MCT/Catalogs/Catalog').AppendChild($temp.ImportNode($xml.PublishedMedia,$true))
    $xml = $temp; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    }
    #,# apply/insert EULA url fix to prevent MCT timing out while downloading it (likely TLS issue under naked Windows 7 host)
    $eula = "${\\}download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9/EULA_MCTool_";$rtf='_6.27.16.rtf'
    if ($null -ne $root.EULAS) {
    foreach ($i in $root.EULAS.EULA) {$i.URL = $eula + $i.LanguageCode.ToUpper() + $rtf}
    } else {
    $tmp = [xml]('<EULA><LanguageCode/><URL/></EULA>'); $el = $xml.CreateElement('EULAS'); $node = $xml.ImportNode($tmp.EULA,$true)
    foreach ($lang in ($root.Languages.Language |where {$_.LanguageCode -ne 'default'})) {
    $i = $el.AppendChild($node.Clone()); $lc = $lang.LanguageCode; $i.LanguageCode = $lc; $i.URL = $eula + $lc.ToUpper() + $rtf
    }
    $null = $root.AppendChild($el)
    }
    #,# friendlier version + combined consumer editions label (not doing it for business too here as it would be ignored by mct)
    if ($null -ne $root.Languages) {
    if ($ver -gt 1703) {$CONSUMER = "$vid Home | Pro | Edu"} else {$CONSUMER = "$vid Home | Pro"} #,# 1511
    foreach ($i in $root.Languages.Language) {
    foreach ($l in $i.ChildNodes) {$label = $i.$($l.LocalName); $i.$($l.LocalName) = $label.replace("Windows 10", "$vid")}
    if ($null -ne $i.CLIENT) {$i.CLIENT = "$CONSUMER"} ; if ($null -ne $i.CLIENT_K) {$i.CLIENT_K = "$CONSUMER K"}
    if ($null -ne $i.CLIENT_N) {$i.CLIENT_N = "$CONSUMER N"} ; if ($null -ne $i.CLIENT_KN) {$i.CLIENT_KN = "$CONSUMER KN"}
    }
    }
    #,# unhide combined business editions in xml that include them: 1709 - 21H1; unhide Education on 1507 - 1511; better edition label
    if ($env:UNHIDE_BUSINESS -ge 1) {
    $BUSINESS = "$vid Enterprise | Pro vl | Edu vl"
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64') {continue} ; $edi = $f.Edition; $loc = $f.Edition_Loc
    if ($edi -eq 'Enterprise' -or $edi -eq 'EnterpriseN') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = $BUSINESS}
    if ($ver -le 1703 -and ($edi -eq 'Education' -or $edi -eq 'EducationN')) {$f.IsRetailOnly = 'False'} #,# 1511
    }
    }
    #,# insert individual business editions in xml that never included them: 1607, 1703
    $lines = ([io.file]::ReadAllText($env:0)-split':PS_INSERT_BUSINESS_CSV\:')[1]
    if ($null -ne $lines -and $env:INSERT_BUSINESS -ge 1 -and 2104,2004,1909,1703,1607 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';pro='Professional';prN='ProfessionalN';edu='Education';edN='EducationN';
    clo='Cloud';clN='CloudN'}
    #,# insert business entries for 1607, 1703
    if ($ver -le 1703) {
    $files = $root.Files.File |where {$_.Edition -eq "Education" -and $_.Architecture -ne 'ARM64'}
    foreach ($e in 'ent','enN','pro','prN','edu','edN','clo','clN') {
    $items = $csv |where {$_.Client -eq $e} |group Lang -AsHashTable -AsString; if ($null -eq $items) {continue}
    $cli = '_CLIENT' + $edi[$e]; $up = '/upgr/'; if ($ver -eq 1607 -and $e -like 'en*') {$up = '/updt/'} #,# .toupper();
    if ($e -like 'cl*') {$cli += '_RET_'} elseif ($e -like 'p*') {$cli += 'VL_VOL_'} else {$cli += '_VOL_'}
    if ($e -like 'cl*') {$BUSINESS = $edi[$e] -replace 'Cloud','S'} else {$BUSINESS = $edi[$e] -creplace 'N',' N'}
    foreach ($f in $files) {
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items[$lang]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly = 'False'; $c.Edition = $edi[$e]
    $name = $env:CB + $cli + $arch + 'FRE_' + $lang; $c.Size = $i[0]; $c.Sha1 = $i[1]
    $c.FileName = $name + '.esd'; $c.FilePath = $url + $i[2] + $up + $env:CD + $name.tolower() + '_' + $i[1] + '.esd'
    $c.Edition_Loc = "$vid $BUSINESS"
    $null = $root.Files.AppendChild($c)
    }
    }
    }
    #,# update existing FilePath entries for 1909, 2004
    if ($ver -gt 1703) {
    $items = $csv |group Client,Lang -AsHashTable -AsString
    if ($null -ne $items) {
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64' -or $f.Edition_Loc -eq '%BASE_CHINA%') {continue}
    $cli = '_CLIENTCONSUMER_'; $chan = 'ret'; if ($f.Edition -like 'Enterprise*') {$cli= '_CLIENTBUSINESS_'; $chan = 'vol'}
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items["$chan, $lang"]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $name = $env:CB + $cli + $chan.ToUpper() + '_' + $arch + 'FRE_' + $f.LanguageCode; $f.Size = $i[0]; $f.Sha1 = $i[1]
    $f.FileName = $name + '.esd'; $f.FilePath = $url + $i[2] + '/upgr/' + $env:CD + $name.tolower() + '_' + $i[1] + '.esd'
    }
    }
    }
    }
    #,# clone Professional / Enterprise to work around MCT quirks when host OS is ProEdu / ProWS / EnterpriseS / Embedded
    if ($env:UNHIDE_BUSINESS -ge 1) {
    if ($ver -le 1709) {
    $clone = 'ProfessionalEducation','ProfessionalWorkstation'; if ($ver -le 1511) {$clone += 'Enterprise'}
    $cloneN = 'ProfessionalEducationN','ProfessionalWorkstationN'; if ($ver -le 1511) {$cloneN += 'EnterpriseN'}
    $pro = $root.Files.File |where {$_.Edition -eq "Professional" -and $_.Architecture -ne 'ARM64'}
    foreach ($f in $pro) {
    $clone |% {
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly='False'; $c.Edition="$_"; $null = $root.Files.AppendChild($c)
    }
    }
    $proN = $root.Files.File |where {$_.Edition -eq "ProfessionalN" -and $_.Architecture -ne 'ARM64'}
    foreach ($f in $proN) {
    $cloneN |% {
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly='False'; $c.Edition="$_"; $null = $root.Files.AppendChild($c)
    }
    }
    }
    $ent = $root.Files.File |where {$_.Edition -eq "Enterprise" -and $_.Architecture -ne 'ARM64'}
    foreach ($f in $ent) {
    'EnterpriseS','Embedded' |% {
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly='False'; $c.Edition="$_"; $null = $root.Files.AppendChild($c)
    }
    }
    $entN = $root.Files.File |where {$_.Edition -eq "EnterpriseN" -and $_.Architecture -ne 'ARM64'}
    foreach ($f in $entN) {
    'EnterpriseSN' |% {
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly='False'; $c.Edition="$_"; $null = $root.Files.AppendChild($c)
    }
    }
    }
    $xml.Save("$pwd\products.xml")
    } $:PRODUCTS_XML: #,# MediaCreationTool.bat configuring products.xml in one go


    :: Insert business esd links in 1607,1703; UPDATE 1909 and 2004 by hand until an updated products.xml from microsoft
    :: Following are condensed ver,edition,lang,sizes,hashes,dirs to be recomposed into full official ESD links for MCT
    :: I have chosen to generate them on-the-fly here instead of linking to third-party hosted pre-edited products.xml
    :: Can skip copy-pasting some or all entries if not interested in updating the esd links for specific versions
    :: [Dev] ESD name has all except size; can get it with (Invoke-WebRequest -Uri $url -Method Head).Headers['Content-Length']
    :PS_UPDATE_BUSINESS_CSV:_,Ver,Client,Lang,Size_x64,Size_x86,Sha1_x64,Sha1_x86,Dir_x64,Dir_x86
    :PS_INSERT_BUSINESS_CSV:_,Ver,Client,Lang,Size_x64,Size_x86,Sha1_x64,Sha1_x86,Dir_x64,Dir_x86
    ::#,2004,ret,ar-sa,3424376474,2443826666,b318889964b75cef3a69ec75d28c7ef174157fac,34627c10a75e32440b8655fce3fa160b2561f81e,d,d
    ::#,2004,ret,bg-bg,3497891524,2461077962,89768c1292bb00d8bc59cc93a8bd31bf86fd0d60,b445575585fafced162431c8e491f35b20541083,c,d
    ::#,2004,ret,cs-cz,3489284116,2457579642,47089fda0dbd90725a7de74dcbe18edd8b10ffd5,b5a47c13798de6d47e39d82795d300c826e3e9b6,c,c
    Binary file added MediaCreationTool.zip
    Binary file not shown.
  14. AveYo revised this gist May 23, 2021. 1 changed file with 14 additions and 10 deletions.
    24 changes: 14 additions & 10 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H1!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2021.05.23 final
    :: Changelog: 2021.05.23 rev 1
    :: - 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    :: - 21H1: 19043.928 / 20H2: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379

    @@ -212,8 +212,9 @@ exit/b

    :: show Auto-Upgrade (enhanced), Create-Media (enhanced) or Default (vanilla MCT) choice dialog
    if "%AUTO%%ISO%"=="" call :choices ACT "Default, Auto-Upgrade, Create-Media" 1 "%S% MediaCreationTool" 11 white dodgerblue 360
    if %ACT%0==10 (set ACTION=Default) else if %ACT%0==20 (set ACTION=Auto-Upgrade) else if %ACT%0==30 (set ACTION=Create-Media)
    if %ACT%0==10 (set DEFAULT=1) else if %ACT%0==20 (set AUTO=1) else if %ACT%0==30 (set ISO=1) else (set MCT=& goto begin)
    if "%AUTO%%ISO%"=="" if %ACT%0==10 (set DEFAULT=1) else if %ACT%0==20 (set AUTO=1) else if %ACT%0==30 (set ISO=1)
    if "%AUTO%%ISO%"=="" if %ACT%0 lss 10 set MCT=& goto begin
    if defined AUTO (set ACTION=Auto-Upgrade) else if defined ISO (set ACTION=Create-Media) else (set ACTION=Default)

    :: detect current os_arch, os_langcode, os_edition, os_product, os_ver
    set OS_ARCH=x64& if "%PROCESSOR_ARCHITECTURE:~-2%"=="86" if not defined PROCESSOR_ARCHITEW6432 set OS_ARCH=x86
    @@ -241,9 +242,12 @@ set MEDIA=& for %%s in (%LANGCODE%%EDITION%%ARCH%%KEY%) do (set MEDIA=%%s)
    if defined MEDIA if not defined LANGCODE set LANGCODE=%OS_LANGCODE%
    if defined MEDIA if not defined EDITION set EDITION=%OS_EDITION%
    if defined MEDIA if not defined ARCH set ARCH=%OS_ARCH%
    if defined MEDIA for %%s in (%EDITION%) do (set EDITION=%%s& set OS_EDITION=%%s& set OPTIONS=%OPTIONS% /MediaEdition %%s)
    if defined MEDIA for %%s in (%LANGCODE%) do (set LANGCODE=%%s& set OS_LANGCODE=%%s& set OPTIONS=%OPTIONS% /MediaLangCode %%s)
    if defined MEDIA for %%s in (%ARCH%) do (set ARCH=%%s& set OS_ARCH=%%s& set OPTIONS=%OPTIONS% /MediaArch %%s)

    :: OPTIONS /MediaEdition /MediaLangCode /MediaArch are not supported in MCT versions before 1709
    if defined MEDIA for %%s in (%EDITION%) do (set OS_EDITION=%%s& if %V% geq 1709 set OPTIONS=%OPTIONS% /MediaEdition %%s)
    if defined MEDIA for %%s in (%LANGCODE%) do (set OS_LANGCODE=%%s& if %V% geq 1709 set OPTIONS=%OPTIONS% /MediaLangCode %%s)
    if defined MEDIA for %%s in (%ARCH%) do (set OS_ARCH=%%s& if %V% geq 1709 set OPTIONS=%OPTIONS% /MediaArch %%s)
    if %V% lss 1709 (set KEY=)

    :: show label
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %S% "%>>% & %<%:f1 " %B% "%>>%
    @@ -283,7 +287,7 @@ $ver = $env:V; $vers = $env:S; ${\\}='ht'+'tp://' # baffling pastebin url filter
    ## apply/insert Catalog version attribute for MCT compatibility
    if ($null -ne $xml.MCT) {
    $xml.MCT.Catalogs.Catalog.version = $env:C; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    } else { if ($ver -eq 1703) {$root = $xml.SelectSingleNode('/PublishedMedia');continue}
    } else { if ($ver -eq 1703 -and $env:XML) {$root = $xml.SelectSingleNode('/PublishedMedia');continue}
    $temp = [xml]('<?xml version="1.0" encoding="UTF-8"?><MCT><Catalogs><Catalog version="' + $env:C + '"/></Catalogs></MCT>')
    $null = $temp.SelectSingleNode('/MCT/Catalogs/Catalog').AppendChild($temp.ImportNode($xml.PublishedMedia,$true))
    $xml = $temp; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    @@ -384,7 +388,7 @@ if not defined KEY (del /f /q PID.txt 2>nul) else >PID.txt echo [PID]& for %%s i
    :: generate ISO\auto.cmd for auto upgrade 2nd stage - more reliably pass OPTIONS via setupprep
    >auto.cmd echo @echo off ^& rem MediaCreationTool.bat: auto upgrade Windows 10 with troubleshooting options and less prompts
    >>auto.cmd echo;
    >>auto.cmd echo set OPTIONS=/Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow %OPTIONS%
    >>auto.cmd echo set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow
    >>auto.cmd echo;
    >>auto.cmd echo set F=^&for %%%%i in ("%%~dp0x86\" "%%~dp0x64\" "%%~dp0") do if exist "%%%%~isources\setupprep.exe" set "F=%%%%~i"
    >>auto.cmd echo if not defined F echo [ERROR] ISO sources folder not found ^& timeout -1 ^&exit/b
    @@ -409,8 +413,8 @@ if not defined KEY (del /f /q PID.txt 2>nul) else >PID.txt echo [PID]& for %%s i
    >>auto.cmd echo start "w" "%%F%%sources\setupprep.exe" %%OPTIONS%%

    :: pass auto upgrade 1st stage or create media as MCT setup action and set the working folder
    if 1%AUTO% gtr 10 set OPTIONS=/Eula Accept /Action CreateUpgradeMedia %OPTIONS% & set ISO=%SystemDrive%\ESD\Windows
    if 1%AUTO% leq 10 set OPTIONS=/Eula Accept /Action CreateMedia %OPTIONS% & set ISO=%SystemDrive%\$Windows.~WS\Sources\Windows
    if 1%AUTO% gtr 10 set OPTIONS=%OPTIONS% /Eula Accept /Action CreateUpgradeMedia &set "ISO=%SystemDrive%\ESD\Windows"
    if 1%AUTO% leq 10 set OPTIONS=%OPTIONS% /Eula Accept /Action CreateMedia &set "ISO=%SystemDrive%\$Windows.~WS\Sources\Windows"

    :: finally, run MCT with OPTIONS, wait for sources folder creation, then import auto.cmd and/or PID.txt and/or $OEM$
    set "run=%~dp0MCT\run"
  15. AveYo revised this gist May 23, 2021. 4 changed files with 290 additions and 519 deletions.
    55 changes: 55 additions & 0 deletions .. MediaCreationTool.bat ..md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    _use `download ZIP` button or pastebin link to get the script, as saving the Raw file breaks line endings_

    ![Preview](https://i.imgur.com/zc3Stcl.png)

    >**Dialogs** to pick version, then to pick Default (vanilla MCT) and Auto-Upgrade or Create-Media (enhanced)
    >**Enhanced script name args parsing** - _just rename the script with:_
    > `auto MediaCreationTool.bat` _to auto upgrade 21H1 - unattended, usually straight to desktop_
    > `auto update 1909 MediaCreationTool.bat` _to auto upgrade 1909 with Dynamic Update (latest LCU)_
    > `pro auto 20H2 MediaCreationTool.bat` _to auto upgrade 20H2 and force Professional edition_
    > `enterprise 21H1 iso update MediaCreationTool.bat` _to create 21H1 Enterprise media with Dynamic Update on_
    > Forcing an edition will skip the selection dialog when booting from media, if it's an existing index.
    > ProfessionalWorkstation and ProfessionalEducation should also work, but only for upgrades.
    > Makes editing the script text hardly needed. Can even set a retail / mak product key via script name.
    >**Enhanced Auto Upgrade and Create-Media** presets with embedded and cross-edition fix
    > Now usable from PosReady7 / Embedded where default MCT fails / can't upgrade keeping files and apps.
    > Script waits in the background for MCT to finish the first phase of creating upgrade media.
    > If found, it will import `auto.cmd`, `PID.txt` and `$OEM$` dir, to the iso / usb sources folder.
    > Once that's done, it will launch setupprep for the second phase via `auto.cmd`, then quit.
    > And can start again this unattended upgrade setup (under windows), from `auto.cmd` on the iso / usb.
    >**Dynamic Update** (downloading and installing latest LCU) if enabled, starts only for upgrade action.
    > It won't be included on created media. Instead, it starts if launching `auto.cmd` from media under Windows
    > Unlike using setup directly, it does a seamless upgrade with no prompts and the MCT troubleshooting OPTIONS
    > Working as intended, there's no need to recreate the iso / usb every month - but only on new esd releases.
    > Previously, the script disabled and ignored Dynamic Update, as it was not reliable enough.
    > _(upgrade with dynamic update can still fail with some packages, so not done by default just yet)_
    [discuss on MDL](https://forums.mydigitallife.net/forums/windows-10.54/)

    ```
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
    2018.10.12: added data loss warning for RS5
    2018.11.13: RS5 is officially back! + greatly improved choices dialog - feel free to use the small snippet in your own scripts
    2019.05.22: 1903 [19H1]
    2019.07.11: 1903 __release_svc_refresh__ and enable DynamicUpdate by default to grab latest CU
    2019.09.29: UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    2019.11.16: 19H2 18363.418 as default choice (updated hard-coded links)
    2020.02.29: 19H2 18363.592
    2020.05.28: 2004 19041.264 first release
    2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
    2020.10.30: hotfix utf-8, enterprise on 1909+
    2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
    2020.11.14: generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    2020.11.15: one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    ```
    48 changes: 0 additions & 48 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -1,48 +0,0 @@
    ![Preview1](https://i.imgur.com/EEQbC2k.png)

    >Hello! I bring news. Beside the introduction of **21H1 MCT** ;)
    ![Preview2](https://i.imgur.com/dHYAHiT.png)

    >**First, I have added create media preset(s) that when used, will send you right at the select usb or save iso dialog.**
    >And when booting from the media, the pick edition dialog will be skipped.
    >The attempts I've seen in this thread were mostly failing because /Pkey option is only meant for retail bought keys, not for generic / hwid!
    >To overcome this limitation script simply generates a `PID.txt` with the key you provide and then adds it to the media `sources` folder.
    >**Second, I have reworked the auto upgrade preset (actually more like reverted it to how it was intended initially)**.
    >The notable change is that the script now has to take the initiative and ask for admin rights itself.
    >That's so it can wait in the background for MCT to finish the first phase of creating upgrade media.
    >Once that's done, it will launch setupprep for the second phase (via auto.cmd) and then quit.
    >This allows a seamless upgrade experience with no intermediary prompts.
    >As a bonus, you can set lang, edition, arch, key to upgrade to a different edition than the current one!
    >_I have done plenty of such upgrades today going forward and backward from/to 20H1/20H2/21H1 switching edition several times - since all have the same 19041 base, means you get full upgrade with files, apps and settings saved (if lang and arch are compatible)._
    >Try it out just by renaming the script to `auto MediaCreationTool.bat` - by default starts upgrade to 21H1
    >Can also add the numeric version target: `auto 2004 MediaCreationTool.bat` or `auto 2009 MediaCreationTool.bat`
    >**For those that use the script _as-is_, these enhancements do not affect the workflow in any way.**
    >Script will simply pass control to MCT and quit early as before.
    ```
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
    2018.10.12: added data loss warning for RS5
    2018.11.13: RS5 is officially back! + greatly improved choices dialog - feel free to use the small snippet in your own scripts
    2019.05.22: 1903 [19H1]
    2019.07.11: 1903 __release_svc_refresh__ and enable DynamicUpdate by default to grab latest CU
    2019.09.29: UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    2019.11.16: 19H2 18363.418 as default choice (updated hard-coded links)
    2020.02.29: 19H2 18363.592
    2020.05.28: 2004 19041.264 first release
    2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
    2020.10.30: hotfix utf-8, enterprise on 1909+
    2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
    2020.11.14: generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    2020.11.15: one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    ```
    458 changes: 235 additions & 223 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,178 +2,181 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H1!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2021.03.20
    :: - pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    :: - 2104: 19043.867 / 2009: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379
    :: Changelog: 2021.05.23 final
    :: - 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
    :: - 21H1: 19043.928 / 20H2: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2], 2104 [21H1]
    :: uncomment to skip gui dialog for MCT choice: 1=1507 to 12=21H1 - or rename script: "2104 MediaCreationTool.bat"
    rem set/a MCT=12

    :: comment to not unhide Enterprise for 1709+ in products.xml
    set/a UNHIDE_BUSINESS=1
    :: uncomment to start auto upgrade with more reliable options set - or rename script: "auto MediaCreationTool.bat"
    rem set/a AUTO=1

    :: comment to not insert Enterprise esd links for 1607,1703 or update links for 1909,2004,2104 in products.xml
    set/a UPDATE_BUSINESS=1
    :: uncomment to enable Dynamic Update [upgrade might fail] - or rename script: "auto update MediaCreationTool.bat"
    rem set/a UPDATE=1

    :: uncomment to bypass gui dialog choice and hardcode the MCT version: 1=1507, 2=1511, .. 10=20H1, 11=20H2, 12=21H1
    rem set/a VER=12
    :: uncomment to start iso / usb media creation with selection - or rename script: "iso 21H1 MediaCreationTool.bat"
    rem set/a ISO=1

    :: uncomment to start auto upgrade preset without prompts - or just rename the script to "auto MediaCreationTool.bat"
    rem set/a AUTO=1
    :: uncomment and change autodetected MediaEdition - or rename script: "enterprise iso 1909 MediaCreationTool.bat"
    rem set EDITION=Enterprise

    :: uncomment one to preset MediaLangCode, MediaEdition, MediaArch and generic PID.txt - need all to skip the pick screen
    rem set LANGCODE=en-us & set EDITION=Core & set ARCH=x64 &set PID=YTMG3-N6DKC-DKB77-7M9GH-8HVX7
    rem set LANGCODE=en-us & set EDITION=Professional & set ARCH=x64 &set PID=VK7JG-NPHTM-C97JM-9MPGT-3V66T
    rem set LANGCODE=en-us & set EDITION=Education & set ARCH=x64 &set PID=YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY
    rem set LANGCODE=en-us & set EDITION=Enterprise & set ARCH=x64 &set PID=NPPR9-FWDCX-D2C8J-H872K-2YT43
    :: uncomment and change autodetected MediaLangCode - only some combinations are safe for upgrade ex. en-US to en-GB
    rem set LANGCODE=en-US

    :: comment to not postpone key entering if needed - note that /Pkey value should not be a generic key like the above
    set OPTIONS=%OPTIONS% /Pkey Defer
    :: uncomment and change autodetected MediaArch - cannot keep files on upgrade if not matching the os
    rem set ARCH=x64

    :: comment to allow dynamic update - it increases the duration and failure rate when doing upgrades
    set OPTIONS=%OPTIONS% /DynamicUpdate Disable
    :: uncomment and change autodetected KEY - or rename script - not needed for generic setup keys, already handled
    rem set KEY=NPPR9-FWDCX-D2C8J-H872K-2YT43

    :: comment to allow default setup telemetry
    set OPTIONS=%OPTIONS% /Telemetry Disable

    :: add / remove setup options below if needed - default preset gives the least amount of issues when doing upgrades
    :: comment to not use recommended windows 10 setup options that give the least amount of issues when doing upgrades
    set OPTIONS=%OPTIONS% /Compat IgnoreWarning /CompactOS Disable /MigrateDrivers All /ResizeRecoveryPartition Disable /ShowOOBE None

    :begin
    :: comment to not postpone key entering / disable setup telemetry - note that /Eula is already handled in AUTO or ISO modes
    set OPTIONS=%OPTIONS% /Pkey Defer /Telemetry Disable

    :: comment to not unhide Enterprise for 1709+ in products.xml
    set/a UNHIDE_BUSINESS=1

    :: parse first commandline parameter as version: MediaCreationTool 1909 - can also rename script to "1909 MediaCreationTool.bat"
    set enum=1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009 12.2104
    for %%V in (%enum%) do if %%~xV==.%1 (set/a VER=%%~nV) else for %%N in (%~n0) do if %%~xV==.%%N set/a VER=%%~nV
    :: comment to not insert Enterprise esd links for 1607,1703 or update links for 1909,2004 in products.xml
    set/a UPDATE_BUSINESS=1

    :: parse options to create media with less prompts - also works in auto upgrade preset to switch target edition
    (for %%s in (%LANGCODE%) do set LANGCODE=%%s) & (for %%s in (%EDITION%) do set EDITION=%%s) & (for %%s in (%ARCH%) do set ARCH=%%s)
    if defined LANGCODE set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaLangCode %LANGCODE%
    if defined EDITION set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaEdition %EDITION%
    if defined ARCH set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaArch %ARCH%
    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2], 2104 [21H1]

    :: parse options to auto upgrade with less issues and prompts
    for %%a in (%~n0) do if /i %%a EQU auto set/a AUTO=1
    if defined AUTO if not defined VER set/a VER=12
    :: parse MCT choice from script name - accepts the alternatives: 1909 or 19H2 etc.
    set NR=1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009 12.2104
    for %%V in (%NR% 8.19H1 9.19H2 10.20H1 11.20H2 12.21H1) do for %%/ in (%~n0) do if /i %%~xV==.%%/ set S=%%/& set/a MCT=%%~nV

    :: supress EULA prompt for auto upgrade or create media presets
    if defined MEDIA set OPTIONS=%OPTIONS% /Eula Accept
    if defined AUTO if not defined MEDIA set OPTIONS=%OPTIONS% /Eula Accept
    :: parse AUTO from script name - starts unnatended upgrade / in-place repair / cross-edition
    for %%/ in (%~n0) do if /i %%/ equ auto set/a AUTO=1
    if defined AUTO if not defined MCT set/a MCT=12

    :: choices dialog
    if not defined VER call :choices VER "%CHOICES%" 12 "Create Windows 10 Media" 11 white dodgerblue 300
    @goto choice-%VER%
    :: parse UPDATE from script name - download and apply latest LCU on upgrade [needs more space on C:\ and might fail]
    for %%/ in (%~n0) do if /i %%/ equ update set/a UPDATE=1
    if defined UPDATE (set OPTIONS=%OPTIONS% /DynamicUpdate Enable) else (set OPTIONS=%OPTIONS% /DynamicUpdate Disable)

    :choice-0
    %<%:e1 " NO VER SELECTED "%>% & popd & timeout /t 5 >nul & exit/b
    :: parse ISO from script name - starts iso / usb media creation with selection
    for %%/ in (%~n0) do if /i %%/ equ iso set/a ISO=1

    :: parse EDITION from script name - accepts one of the staged editions in MCT install.esd - see sources\product.ini
    set EDI=%EDITION% %~n0 & rem : also accepts the alternative names: Home, HomeN, Pro, ProN
    for %%/ in (%EDI:Home=Core% %EDI:ProN=ProfessionalN% %EDI:Pro =Professional %) do for %%E in (
    CoreSingleLanguage Core CoreN Professional ProfessionalN Education EducationN Enterprise EnterpriseN
    ProfessionalEducation ProfessionalEducationN ProfessionalWorkstation ProfessionalWorkstationN
    ) do if /i %%/==%%E (set EDITION=%%E)

    :: parse KEY from script name - accepts the format: AAAAA-VVVVV-EEEEE-YYYYY-OOOOO
    for %%/ in (%KEY% %~n0) do for /f "tokens=1-5 delims=-" %%a in ("%%/") do if "%%e" neq "" (set PKEY=%%/)
    if defined PKEY set "PKEY1=%PKEY:~-1%" & set "PKEY28=%PKEY:~28,1%"
    if defined EDITION if "%PKEY1%" equ "%PKEY28%" (set KEY=%PKEY%)

    :: hint: if you want setup to run a tweaking script before first logon, save it at $OEM$\$$\Setup\Scripts\setupcomplete.cmd

    :begin

    :: show MCT choice dialog
    if not defined MCT call :choices MCT "%CHOICES%" 12 "MediaCreationTool" 11 white dodgerblue 360
    goto choice-%MCT%

    :choice-12
    set "V=2104" & set "B=19043.867.210305-1751.21h1_release_svc_refresh" & set "D=2021/03/" & set "C=1.4.1"
    set "CAB=http://download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=http://download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    :: refreshed 19041 base with integrated 21H1 enablement package - pre-release, generated
    set "V=2104" & set "S=21H1" & set "B=19043.928.210409-1212.21h1_release_svc_refresh" & set "D=2021/04/" & set "C=1.4.1"
    set "CAB=%\\%download.microsoft.com/download/f/d/d/fddbe550-0dbf-44b4-9e60-6f0e73d654c0/products_20210415.cab"
    set "MCT=%\\%download.microsoft.com/download/d/5/2/d528a4e0-03f3-452d-a98e-3e479226d166/MediaCreationTool21H1.exe"
    :: refreshed 19041 base with integrated 21H1 enablement package - release
    goto process

    :choice-11
    set "V=2009" & set "B=19042.631.201119-0144.20h2_release_svc_refresh" & set "D=2020/11/" & set "C=1.4.1"
    set "CAB=http://download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=http://download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    set "V=2009" & set "S=20H2" & set "B=19042.631.201119-0144.20h2_release_svc_refresh" & set "D=2020/11/" & set "C=1.4.1"
    set "CAB=%\\%download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=%\\%download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    :: refreshed 19041 base with integrated 20H2 enablement package to mainly bundle ChrEdge
    goto process

    :choice-10
    set "V=2004" & set "B=19041.508.200907-0256.vb_release_svc_refresh" & set "D=2020/09/" & set "C=1.4"
    set "V=2004" & set "S=20H1" & set "B=19041.508.200907-0256.vb_release_svc_refresh" & set "D=2020/09/" & set "C=1.4"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=19041.572.201009-1946.vb_release_svc_refresh" & set "D=2020/11/"
    set "CAB=http://download.microsoft.com/download/7/4/4/744ccd60-3203-4eea-bfa2-4d04e18a1552/products.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/8d71966f-05fd-4d64-900b-f49135257fa5/MediaCreationTool2004.exe"
    set "CAB=%\\%download.microsoft.com/download/7/4/4/744ccd60-3203-4eea-bfa2-4d04e18a1552/products.cab"
    set "MCT=%\\%software-download.microsoft.com/download/pr/8d71966f-05fd-4d64-900b-f49135257fa5/MediaCreationTool2004.exe"
    :: visible improvements to windows update, defender, search, dx12, wsl, sandbox
    goto process

    :choice-9
    set "V=1909" & set "B=18363.592.200109-2016.19h2_release_svc_refresh" & set "D=2020/01/" & set "C=1.3"
    set "V=1909" & set "S=19H2" & set "B=18363.592.200109-2016.19h2_release_svc_refresh" & set "D=2020/01/" & set "C=1.3"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=18363.1139.201008-0514.19h2_release_svc_refresh" & set "D=2020/11/"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    set "CAB=%\\%download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=%\\%download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    :: refreshed 18362 base with integrated 19H2 enablement package to activate usability and security fixes
    goto process

    :choice-8
    set "V=1903" & set "B=18362.356.190909-1636.19h1_release_svc_refresh" & set "D=2019/09/" & set "C=1.3"
    set "CAB=http://download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=http://download.microsoft.com/download/9/8/8/9886d5ac-8d7c-4570-a3af-e887ce89cf65/MediaCreationTool1903.exe"
    set "V=1903" & set "S=19H1" & set "B=18362.356.190909-1636.19h1_release_svc_refresh" & set "D=2019/09/" & set "C=1.3"
    set "CAB=%\\%download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=%\\%download.microsoft.com/download/9/8/8/9886d5ac-8d7c-4570-a3af-e887ce89cf65/MediaCreationTool1903.exe"
    :: modern windows 10 starts here with proper memory allocation, cpu scheduling, security features
    goto process

    :choice-7
    set "V=1809" & set "B=17763.379.190312-0539.rs5_release_svc_refresh" & set "D=2019/03/" & set "C=1.3"
    set "CAB=http://download.microsoft.com/download/8/E/8/8E852CBF-0BCC-454E-BDF5-60443569617C/products_20190314.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    set "V=1809" & set "S=1809" & set "B=17763.379.190312-0539.rs5_release_svc_refresh" & set "D=2019/03/" & set "C=1.3"
    set "CAB=%\\%download.microsoft.com/download/8/E/8/8E852CBF-0BCC-454E-BDF5-60443569617C/products_20190314.cab"
    set "MCT=%\\%software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    :: rather mediocre considering it is the base for ltsc 2019; less smooth than 1803 in games; intel pre-4th-gen still buggy
    goto process

    :choice-6
    set "V=1803" & set "B=17134.112.180619-1212.rs4_release_svc_refresh" & set "D=2018/07/" & set "C=1.2"
    set "CAB=http://download.microsoft.com/download/5/C/B/5CB83D2A-2D7E-4129-9AFE-353F8459AA8B/products_20180705.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    set "V=1803" & set "S=1803" & set "B=17134.112.180619-1212.rs4_release_svc_refresh" & set "D=2018/07/" & set "C=1.2"
    set "CAB=%\\%download.microsoft.com/download/5/C/B/5CB83D2A-2D7E-4129-9AFE-353F8459AA8B/products_20180705.cab"
    set "MCT=%\\%software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    :: update available to finally fix most standby memory issues that were present since 1703; intel pre-4th-gen still buggy
    goto process

    :choice-5
    set "V=1709" & set "B=16299.125.171213-1220.rs3_release_svc_refresh" & set "D=2018/01/" & set "C=1.1"
    set "CAB=http://download.microsoft.com/download/3/2/3/323D0F94-95D2-47DE-BB83-1D4AC3331190/products_20180105.cab"
    set "MCT=http://download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    set "V=1709" & set "S=1709" & set "B=16299.125.171213-1220.rs3_release_svc_refresh" & set "D=2018/01/" & set "C=1.1"
    set "CAB=%\\%download.microsoft.com/download/3/2/3/323D0F94-95D2-47DE-BB83-1D4AC3331190/products_20180105.cab"
    set "MCT=%\\%download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    :: plagued by standby and other memory allocation bugs, fullscreen optimisation issues, worst version of windows 10 by far
    goto process

    :choice-4
    set "V=1703" & set "B=15063.0.170317-1834.rs2_release" & set "D=2017/03/" & set "C=1.0"
    set "V=1703" & set "S=1703" & set "B=15063.0.170317-1834.rs2_release" & set "D=2017/03/" & set "C=1.0"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=15063.0.170710-1358.rs2_release_svc_refresh" & set "D=2017/07/"
    rem set "XML=http://download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    rem set "XML=%\\%download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    rem above refreshed xml often fails decrypting dual x86 + x64 - using rtm instead; the added enterprise + cloud are refreshed
    set "CAB=http://download.microsoft.com/download/9/5/4/954415FD-D9D7-4E1F-8161-41B3A4E03D5E/products_20170317.cab"
    set "MCT=http://download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35B8FA35EC3F/MediaCreationTool.exe"
    set "CAB=%\\%download.microsoft.com/download/9/5/4/954415FD-D9D7-4E1F-8161-41B3A4E03D5E/products_20170317.cab"
    set "MCT=%\\%download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35B8FA35EC3F/MediaCreationTool.exe"
    :: some gamers still find it the best despite unfixed memory allocation bugs and exposed cpu flaws; can select Cloud (S)
    goto process

    :choice-3
    set "V=1607" & set "B=14393.0.161119-1705.rs1_refresh" & set "D=2017/01/" & set "C=1.0"
    set "CAB=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products_20170116.cab"
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    set "V=1607" & set "S=1607" & set "B=14393.0.161119-1705.rs1_refresh" & set "D=2017/01/" & set "C=1.0"
    set "CAB=%\\%wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products_20170116.cab"
    set "MCT=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: snappy and stable for legacy hardware
    goto process

    :choice-2
    set "V=1511" & set "B=10586.0.160426-1409.th2_refresh" & set "D=2016/05/" & set "C=1.0"
    set "XML=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products05242016.xml"
    set "MCT=http://download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    set "V=1511" & set "S=1511" & set "B=10586.0.160426-1409.th2_refresh" & set "D=2016/05/" & set "C=1.0"
    set "XML=%\\%wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products05242016.xml"
    set "MCT=%\\%download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    rem 1511 MCT exe works and can select Education - using 1607 one instead anyway for unified products.xml catalog 1.0 format
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    set "MCT=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: most would rather go with 1507 or 1607 instead as with a little effort can apply latest ltsb updates on all editions
    goto process

    :choice-1
    set "V=1507" & set "B=10240.16393.150909-1450.th1_refresh" & set "D=2015/09/" & set "C=1.0"
    set "XML=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products09232015_2.xml"
    set "MCT=http://download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationToolx64.exe"
    set "MCT32=http://download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationTool.exe"
    set "V=1507" & set "S=1507" & set "B=10240.16393.150909-1450.th1_refresh" & set "D=2015/09/" & set "C=1.0"
    set "XML=%\\%wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products09232015_2.xml"
    set "MCT=%\\%download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationToolx64.exe"
    set "MCT32=%\\%download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationTool.exe"
    if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if not defined PROCESSOR_ARCHITEW6432 set "MCT=%MCT32%"
    rem 1507 MCT exe works but cant select Education - using 1607 one instead anyway for unified products.xml catalog 1.0 format
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    set "MCT=%\\%download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: fastest for potato PCs
    goto process

    :init script
    @echo off & title %1 & color 1f & mode 120,30
    :: self-echo top 2-20 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,21) do set \=& set/p \=& call echo;%%\%%)
    :: lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    for /f "delims=:" %%\ in ('echo;prompt $h$s$h:^|cmd/d') do set "|=%%\" &set ">>=\..\c nul &set/p \=%%\%%\%%\%%\%%\%%\%%\<nul&popd"
    set "<=pushd "%allusersprofile%"&2>nul findstr /c:\ /a" &set ">=%>>%&echo;" &set "|=%|:~0,1%" &set/p \=\<nul>"%allusersprofile%\c"
    :: generate a latest_MCT_script.url file for manual update - could have made the script to update itself, but decided against it
    for %%s in (latest_MCT_script.url) do if not exist %%s (echo;[InternetShortcut]&echo;URL=https://git.io/MediaCreationTool.bat)>%%s
    :: use MCT workfolder
    pushd "%~dp0" & mkdir MCT >nul 2>nul & pushd MCT
    :: (un)define main variables
    set ARCH=& set LANGCODE=& set EDITION=& set PID=& set MEDIA=& set AUTO=& set VER=& set XML=& set CAB=& set OPTIONS=/Selfhost
    exit/b
    :choice-
    :choice-0
    %<%:e1 " NO MCT SELECTED "%>% & popd & timeout /t 10 >nul & exit/b

    :choices dialog: 1=variable 2="c,h,o,i,c,e,s" 3=selected-index [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=winsize
    set "0=%~f0" &set 1=%*& powershell -nop -c "iex(([io.file]::ReadAllText($env:0)-split':PS_CHOICES\:.*')[1]+'Choices '+$env:1)">nul
    @@ -187,14 +190,70 @@ function Choices ($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc=
    $f.AcceptButton=$bt[$sel-1]; $f.CancelButton=$bt[-1]; $f.Add_Shown({$f.Activate();$bt[$sel-1].focus()}); $null=$f.ShowDialog()
    if ($global:rez -ne $ch.length) {exit $global:rez} else {exit 0} } :PS_CHOICES: gui choices returning index - snippet by AveYo

    :process selected
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %V% "%>>% & %<%:f1 " %B% "%>>%
    if defined MEDIA %<%:8f " %LANGCODE% "%>>% & %<%:3f " %EDITION% "%>>% & %<%:5f " %ARCH% "%>>%
    :reg_query "HKCU\KeyName" "ValueName" Var
    (for /f "tokens=2*" %%R in ('reg query "%~1" /v "%~2" /se "," 2^>nul') do set "%~3=%%S") &exit/b

    :init script
    @echo off & title %1 & color 1f & mode 120,30 & (set __COMPAT_LAYER=Installer)
    :: self-echo top 1-20 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,22) do set \=& set/p \=& call echo;%%\%%)
    :: lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    for /f "delims=:" %%\ in ('echo;prompt $h$s$h:^|cmd/d') do set "|=%%\" &set ">>=\..\c nul &set/p \=%%\%%\%%\%%\%%\%%\%%\<nul&popd"
    set "<=pushd "%allusersprofile%"&2>nul findstr /c:\ /a" &set ">=%>>%&echo;" &set "|=%|:~0,1%" &set/p \=\<nul>"%allusersprofile%\c"
    :: generate a latest_MCT_script.url file for manual update - could have made the script to update itself, but decided against it
    for %%s in (latest_MCT_script.url) do if not exist %%s (echo;[InternetShortcut]&echo;URL=git.io/MediaCreationTool.bat)>%%s
    :: baffling pastebin url filters..
    for %%s in (tp://) do set "\\=ht%%s"
    :: (un)define main variables
    set OPTIONS=/Selfhost& for %%v in (ACT DEFAULT AUTO ISO UPDATE EDITION KEY ARCH LANGCODE XML CAB MCT S) do (set %%v=)
    exit/b

    :process MCT choice

    :: show Auto-Upgrade (enhanced), Create-Media (enhanced) or Default (vanilla MCT) choice dialog
    if "%AUTO%%ISO%"=="" call :choices ACT "Default, Auto-Upgrade, Create-Media" 1 "%S% MediaCreationTool" 11 white dodgerblue 360
    if %ACT%0==10 (set ACTION=Default) else if %ACT%0==20 (set ACTION=Auto-Upgrade) else if %ACT%0==30 (set ACTION=Create-Media)
    if %ACT%0==10 (set DEFAULT=1) else if %ACT%0==20 (set AUTO=1) else if %ACT%0==30 (set ISO=1) else (set MCT=& goto begin)

    :: detect current os_arch, os_langcode, os_edition, os_product, os_ver
    set OS_ARCH=x64& if "%PROCESSOR_ARCHITECTURE:~-2%"=="86" if not defined PROCESSOR_ARCHITEW6432 set OS_ARCH=x86
    call :reg_query "HKU\S-1-5-18\Control Panel\Desktop\MuiCached" "MachinePreferredUILanguages" OS_LANGCODE
    for %%s in (%OS_LANGCODE%) do (set OS_LANGCODE=%%s)
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "EditionID" OS_EDITION
    call :reg_query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName" OS_PRODUCT
    for /f "tokens=4-5 delims=. " %%i in ('ver') do set/a OS_VER=%%i%%j

    :: upgrade fix for Windows Embedded / PosReady7 - override edition with Windows 10 Enterprise
    if /i "%OS_EDITION%" equ "Embedded" (set EDITION=Enterprise& set KEY=)

    :: preset generic key - only staged editions in MCT install.esd - see sources\product.ini
    if defined EDITION for %%/ in (%EDITION%) do for %%K in ( BT79Q-G7N6G-PGBYW-4YWX6-6F4BT.CoreSingleLanguage
    YTMG3-N6DKC-DKB77-7M9GH-8HVX7.Core 4CPRK-NM3K3-X6XXQ-RXX86-WXCHW.CoreN
    VK7JG-NPHTM-C97JM-9MPGT-3V66T.Professional 2B87N-8KFHP-DKV6R-Y2C8J-PKCKT.ProfessionalN
    8PTT6-RNW4C-6V7J2-C2D3X-MHBPB.ProfessionalEducation GJTYN-HDMQY-FRR76-HVGC7-QPF8P.ProfessionalEducationN
    DXG7C-N36C4-C4HTG-X4T3X-2YV77.ProfessionalWorkstation WYPNQ-8C467-V2W6J-TX4WX-WT2RQ.ProfessionalWorkstationN
    YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY.Education 84NGF-MHBT6-FXBX8-QWJK7-DRR8H.EducationN
    NPPR9-FWDCX-D2C8J-H872K-2YT43.Enterprise DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4.EnterpriseN
    ) do if /i %%~xK==.%%/ (set EDITION=%%~xK& call set EDITION=%%EDITION:.=%%& if not defined KEY set KEY=%%~nK)

    :: parse options to create iso / usb media with less prompts - also works in auto upgrade preset to switch target edition
    set MEDIA=& for %%s in (%LANGCODE%%EDITION%%ARCH%%KEY%) do (set MEDIA=%%s)
    if defined MEDIA if not defined LANGCODE set LANGCODE=%OS_LANGCODE%
    if defined MEDIA if not defined EDITION set EDITION=%OS_EDITION%
    if defined MEDIA if not defined ARCH set ARCH=%OS_ARCH%
    if defined MEDIA for %%s in (%EDITION%) do (set EDITION=%%s& set OS_EDITION=%%s& set OPTIONS=%OPTIONS% /MediaEdition %%s)
    if defined MEDIA for %%s in (%LANGCODE%) do (set LANGCODE=%%s& set OS_LANGCODE=%%s& set OPTIONS=%OPTIONS% /MediaLangCode %%s)
    if defined MEDIA for %%s in (%ARCH%) do (set ARCH=%%s& set OS_ARCH=%%s& set OPTIONS=%OPTIONS% /MediaArch %%s)

    :: show label
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %S% "%>>% & %<%:f1 " %B% "%>>%
    %<%:8f " %OS_LANGCODE% "%>>% & %<%:3f " %OS_EDITION% "%>>% & %<%:5f " %OS_ARCH% "%>>%
    %<%:11 ~%>% & echo;
    :: cleanup workfolder
    (del /f /q products.* & rd /s/q %systemdrive%\$Windows.~WS %systemdrive%\$WINDOWS.~BT) 2>nul
    set latest=0 & if exist latest set/p latest=<latest
    echo,20210319>latest & if %latest% LSS 20201211 del /f /q products*.* MediaCreationTool*.exe 2>nul

    :: cleanup MCT\ workfolder
    pushd "%~dp0" & mkdir MCT >nul 2>nul & pushd MCT
    del /f /q products.* 2>nul & set/a latest=0 & if exist latest set/p latest=<latest
    echo,20210523>latest & if %latest% LEQ 20210521 del /f /q products*.* MediaCreationTool*.exe 2>nul

    :: download MCT and CAB / XML
    set "DOWN=function dl($u,$f){$w=new-object System.Net.WebClient; $w.Headers.Add('user-agent','ipad'); try{$w.DownloadFile($u,$f)}"
    @@ -214,12 +273,12 @@ if exist products%V%.cab expand.exe -R products%V%.cab -F:* . >nul 2>nul
    echo; & set "err=" & for %%s in (products.xml MediaCreationTool%V%.exe) do if not exist %%s set err=1
    if defined err %<%:4f " ERROR "%>>% & %<%:0f " Check urls in browser | del MCT dir | unblock powershell | enable BITS serv "%>%
    if defined err del /f /q products%V%.* MediaCreationTool%V%.exe 2>nul &pause &exit/b
    if not defined err %<%:0f " MCT starts after configuring products.xml, please wait..."%>%
    if not defined err %<%:0f " MCT %ACTION% starts after configuring products.xml, please wait..."%>%

    :: configure products.xml - editing in one go
    :: configure products.xml - editing in one go via powershell snippet
    set "0=%~f0" & powershell -nop -c $f0=[io.file]::ReadAllText($env:0);iex(($f0-split':PRODUCTS_XML\:.*')[1]) & goto :PRODUCTS_XML:
    [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",[Text.Encoding]::UTF8)
    $ver = $env:V; if ($ver -eq 2009) {$vers = "20H2"} elseif ($ver -eq 2104) {$vers = "21H1"} else {$vers = $ver}
    $ver = $env:V; $vers = $env:S; ${\\}='ht'+'tp://' # baffling pastebin url filters..

    ## apply/insert Catalog version attribute for MCT compatibility
    if ($null -ne $xml.MCT) {
    @@ -231,7 +290,7 @@ if ($null -ne $xml.MCT) {
    }

    ## apply/insert EULA url fix to prevent MCT timing out while downloading it (likely TLS issue under naked Windows 7 host)
    $eula = 'http://download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9/EULA_MCTool_'; $rtf = '_6.27.16.rtf'
    $eula = "${\\}download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9/EULA_MCTool_";$rtf='_6.27.16.rtf'
    if ($null -ne $root.EULAS) {
    foreach ($i in $root.EULAS.EULA) {$i.URL = $eula + $i.LanguageCode.ToUpper() + $rtf}
    } else {
    @@ -263,7 +322,7 @@ if ($env:UNHIDE_BUSINESS -ge 1) {
    }

    ## insert individual business editions in xml that never included them: 1607, 1703
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://fg.ds.b1.download.windowsupdate.com/'
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = "${\\}fg.ds.b1.download.windowsupdate.com/"
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2104,2004,1909,1703,1607,1511 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';pro='Professional';prN='ProfessionalN';edu='Education';edN='EducationN';
    @@ -290,13 +349,15 @@ if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2104,2004,1909,1703,16
    ## update existing entries for 1909, 2004; add pre-release 2104 entries
    if ($ver -gt 1703) {
    $items = $csv |group Client,Lang -AsHashTable -AsString
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64' -or $f.Edition_Loc -eq '%BASE_CHINA%') {continue}
    $cli = '_CLIENTCONSUMER_'; $chan = 'ret'; if ($f.Edition -like 'Enterprise*') {$cli= '_CLIENTBUSINESS_'; $chan = 'vol'}
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items["$chan, $lang"]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $name = $env:B + $cli + $chan.ToUpper() + '_' + $arch + 'FRE_' + $f.LanguageCode; $f.Size = $i[0]; $f.Sha1 = $i[1]
    $f.FileName = $name + '.esd'; $f.FilePath = $url + $i[2] + '/upgr/' + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    if ($null -ne $items) {
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64' -or $f.Edition_Loc -eq '%BASE_CHINA%') {continue}
    $cli = '_CLIENTCONSUMER_'; $chan = 'ret'; if ($f.Edition -like 'Enterprise*') {$cli= '_CLIENTBUSINESS_'; $chan = 'vol'}
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items["$chan, $lang"]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $name = $env:B + $cli + $chan.ToUpper() + '_' + $arch + 'FRE_' + $f.LanguageCode; $f.Size = $i[0]; $f.Sha1 = $i[1]
    $f.FileName = $name + '.esd'; $f.FilePath = $url + $i[2] + '/upgr/' + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    }
    }
    }
    }
    @@ -309,38 +370,65 @@ makecab products.xml products.cab >nul
    :: add a short delay to see the script output since the xml processing is too fast :D
    timeout 5 >nul

    :: launch MCT executable with OPTIONS and close script if there is nothing to import into sources folder
    if not defined AUTO if not defined PID if not exist ..\$OEM$\* start MediaCreationTool%V%.exe %OPTIONS% &exit/b

    :: generate auto.cmd for auto upgrade custom preset with less issues
    if defined AUTO set OPTIONS=%OPTIONS% /MigChoice Upgrade /Auto Upgrade
    >auto.cmd echo @set OPTIONS=%OPTIONS% /Action UpgradeNow
    >>auto.cmd echo @if exist "%%~dp0sources\setupprep.exe" start "w" "%%~dp0sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    >>auto.cmd echo @if exist "%%~dp0x64\sources\setupprep.exe" start "w" "%%~dp0x64\sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    >>auto.cmd echo @if exist "%%~dp0x86\sources\setupprep.exe" start "w" "%%~dp0x86\sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    if defined AUTO (set OPTIONS=%OPTIONS% /Action CreateUpgradeMedia) else if defined MEDIA set OPTIONS=%OPTIONS% /Action CreateMedia
    :: Default action = just launch MCT executable with OPTIONS and close script without further enhancements
    if defined DEFAULT start MediaCreationTool%V%.exe %OPTIONS% &exit/b

    :: generate PID.txt if PID was supplied to select a specific edition with less prompts
    if not defined PID (del /f /q PID.txt 2>nul) else echo [PID]>PID.txt & for %%s in (%PID%) do echo Value=%%s >>PID.txt
    :: -------------------------------------------------------------------------------------------------------------------------------

    :: hint: if you want setup to run a tweaking script before first logon, save it at $OEM$\$$\Setup\Scripts\setupcomplete.cmd

    :: launch MCT executable with OPTIONS and wait it to create sources folder, then import auto.cmd and/or PID.txt and/or $OEM$
    if defined AUTO (set "ROOT=C:\ESD\Windows") else set "ROOT=%SystemDrive%\$Windows.~WS\Sources\Windows"
    set "SRC=%ROOT%\sources" & set "SRC64=%ROOT%\x64\sources" & set "SRC86=%ROOT%\x86\sources"
    set _=cd -Lit('%~dp0MCT'); $MCT=start MediaCreationTool%V%.exe -args '%OPTIONS%' -passthru; if ($null -eq $MCT) {return}
    set _=%_%; ri '%SRC64%\setupprep.exe' -Force -ea 0; ri '%SRC%\setupprep.exe' -Force -ea 0; for (;;) { sleep 20;
    if not defined AUTO set _=%_%; if(Test-Path '%SRC64%\setupprep.exe') {break} if(Test-Path '%SRC%\setupprep.exe') {break}
    set _=%_%; if((gwmi -Class Win32_Process -Filter 'Name=''MediaCreationTool%V%.exe''').ProcessId -le 0) {break} }
    set _=%_%; if((Test-Path 'auto.cmd') -and (Test-Path '%ROOT%\setup.exe')) {copy -Path 'auto.cmd' -Dest '%ROOT%' -Force}
    set _=%_%; if((Test-Path 'PID.txt') -and (Test-Path '%SRC%\setupprep.exe')) {copy -Path 'PID.txt' -Dest '%SRC%' -Force}
    set _=%_%; if((Test-Path 'PID.txt') -and (Test-Path '%SRC64%\setupprep.exe')) {copy -Path 'PID.txt' -Dest '%SRC64%' -Force}
    set _=%_%; if((Test-Path 'PID.txt') -and (Test-Path '%SRC86%\setupprep.exe')) {copy -Path 'PID.txt' -Dest '%SRC86%' -Force}
    set _=%_%; if((Test-Path '..\$OEM$') -and (Test-Path '%SRC%\setupprep.exe')) {xcopy /CYBERHIQ '..\$OEM$' '%SRC%\$OEM$'}
    set _=%_%; if((Test-Path '..\$OEM$') -and (Test-Path '%SRC64%\setupprep.exe')) {xcopy /CYBERHIQ '..\$OEM$' '%SRC64%\$OEM$'}
    set _=%_%; if((Test-Path '..\$OEM$') -and (Test-Path '%SRC86%\setupprep.exe')) {xcopy /CYBERHIQ '..\$OEM$' '%SRC86%\$OEM$'}
    if defined AUTO set _=%_%; if(Test-Path '%ROOT%\auto.cmd') {start '%ROOT%\auto.cmd'}
    powershell -nop -c "start powershell -args ('-nop -win 1 -c',$env:_) -verb runas;" 2>nul &exit/b
    :: generate sources\PID.txt to preset EDITION on boot media - MCT install.esd indexes only, ProWS/ProEdu auto upgrade ONLY
    if not defined AUTO for %%/ in (Workstation WorkstationN Education EducationN) do if "Professional%%/"=="%EDITION%" (set KEY=)
    if not defined KEY (del /f /q PID.txt 2>nul) else >PID.txt echo [PID]& for %%s in (%KEY%) do (>>PID.txt echo Value=%%s)

    :: generate ISO\auto.cmd for auto upgrade 2nd stage - more reliably pass OPTIONS via setupprep
    >auto.cmd echo @echo off ^& rem MediaCreationTool.bat: auto upgrade Windows 10 with troubleshooting options and less prompts
    >>auto.cmd echo;
    >>auto.cmd echo set OPTIONS=/Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow %OPTIONS%
    >>auto.cmd echo;
    >>auto.cmd echo set F=^&for %%%%i in ("%%~dp0x86\" "%%~dp0x64\" "%%~dp0") do if exist "%%%%~isources\setupprep.exe" set "F=%%%%~i"
    >>auto.cmd echo if not defined F echo [ERROR] ISO sources folder not found ^& timeout -1 ^&exit/b
    >>auto.cmd echo;
    >>auto.cmd echo :: cross-edition upgrade check
    >>auto.cmd echo set MediaEdition=^&set ME=%%OPTIONS:*/MediaEdition =%%
    >>auto.cmd echo if "%%ME%%" neq "%%OPTIONS%%" for /f %%%%i in ("%%ME%%") do set "MediaEdition=%%%%i"
    >>auto.cmd echo if not defined MediaEdition goto upgrade
    >>auto.cmd echo set cv="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    >>auto.cmd echo for /f "tokens=2*" %%%%R in ('reg query %%cv%% /v EditionID 2^^^>nul') do set "EditionID=%%%%S"
    >>auto.cmd echo for /f "tokens=2*" %%%%R in ('reg query %%cv%% /v ProductName 2^^^>nul') do set "ProductName=%%%%S"
    >>auto.cmd echo for /f "tokens=4-5 delims=. " %%%%i in ('ver') do set/a OS_VER=%%%%i%%%%j
    >>auto.cmd echo if %%OS_VER%% LSS 100 if /i "%%EditionID%%-%%MediaEdition%%" neq "Embedded-Enterprise" goto upgrade
    >>auto.cmd echo if /i "%%MediaEdition%%" equ "%%EditionID%%" goto upgrade
    >>auto.cmd echo fltmc^>nul ^|^| (echo [WARNING] MediaEdition mismatch - Run as administrator to bypass ^&timeout /t 10)
    >>auto.cmd echo;
    >>auto.cmd echo :: cross-edition upgrade workaround
    >>auto.cmd echo reg add %%cv%% /v EditionID /d "%%MediaEdition%%" /f ^& reg delete %%cv%% /v ProductName /f
    >>auto.cmd echo reg add %%cv%% /v EditionID_undo_rename /d "%%EditionID%%" /f
    >>auto.cmd echo reg add %%cv%% /v ProductName_undo_delete /d "%%ProductName%%" /f
    >>auto.cmd echo :upgrade
    >>auto.cmd echo start "w" "%%F%%sources\setupprep.exe" %%OPTIONS%%

    :: pass auto upgrade 1st stage or create media as MCT setup action and set the working folder
    if 1%AUTO% gtr 10 set OPTIONS=/Eula Accept /Action CreateUpgradeMedia %OPTIONS% & set ISO=%SystemDrive%\ESD\Windows
    if 1%AUTO% leq 10 set OPTIONS=/Eula Accept /Action CreateMedia %OPTIONS% & set ISO=%SystemDrive%\$Windows.~WS\Sources\Windows

    :: finally, run MCT with OPTIONS, wait for sources folder creation, then import auto.cmd and/or PID.txt and/or $OEM$
    set "run=%~dp0MCT\run"
    >run echo $ISO='%ISO:'=''%'; cd -Lit(split-path '%run:'=''%')
    ::>>run echo ri $($env:SystemDrive+'\$Windows.~WS'),$($env:SystemDrive+'\$WINDOWS.~BT') -recurse -force -ea 0
    >>run echo $MCT=start MediaCreationTool%V%.exe '%OPTIONS:'=''%' -passthru; if ($null -eq $MCT) {return}
    >>run echo "$ISO\x64\sources","$ISO\sources" ^|%% {ri "$_\setup.exe" -force -ea 0}
    >>run echo for (;;) {
    >>run echo sleep 20; if ((gwmi -Class Win32_Process -Filter 'Name="MediaCreationTool%V%.exe"').ProcessId -le 0) {break}
    if not defined AUTO >>run echo "$ISO\x64\sources","$ISO\sources" ^|%% {if (Test-Path "$_\setup.exe") {break}}
    >>run echo }
    >>run echo "$ISO\x86\sources","$ISO\x64\sources","$ISO\sources" ^|%% {
    >>run echo if ((Test-Path "$_\setupprep.exe")-and(Test-Path "PID.txt")) {copy -Path "PID.txt" -Dest $_ -force}
    >>run echo if ((Test-Path "$_\setupprep.exe")-and(Test-Path '..\$OEM$')) {xcopy /CYBERHIQ '..\$OEM$' $($_+'\$OEM$')}
    >>run echo }
    >>run echo if (Test-Path "$ISO\setup.exe") {copy -Path "auto.cmd" -Dest $ISO -force}
    if defined AUTO >>run echo if (Test-Path "$ISO\auto.cmd") {start "$ISO\auto.cmd"}
    powershell -c start powershell \"" -win 1 -c iex([io.file]::ReadAllText('%run:'=''%')); \"" -verb runas &exit/b

    exit || DONE! AveYo: can skip some or all entries below if not interested in updating the esd links in products.xml

    @@ -349,82 +437,6 @@ exit || DONE! AveYo: can skip some or all entries below if not interested in upd
    :: I have chosen to generate them on-the-fly here instead of linking to third-party hosted pre-edited products.xml
    :: [Dev] ESD name has all except size; can get it with (Invoke-WebRequest -Uri $url -Method Head).Headers['Content-Length']
    :PS_UPDATE_BUSINESS_CSV:_,Ver,Client,Lang,Size_x64,Size_x86,Sha1_x64,Sha1_x86,Dir_x64,Dir_x86
    ::#,2104,ret,ar-sa,3424078046,2433096242,5ec896e8eee82f142748536776df0ce6e01e5857,6526fdfcc023131e2de14f67064410b5938e57e6,c,c
    ::#,2104,ret,bg-bg,3487532575,2456193792,907a21b2b44f85c54ca50336b76357e31911564b,7e7ed3758311ff6aced8a46f0106beb182e6e291,c,c
    ::#,2104,ret,cs-cz,3488305302,2449171705,5909dcf04964f65bb078cc2db031d5f640ac4f9d,40b1495eb91b3f8324fffbe226fbfcf1dc74bff9,c,c
    ::#,2104,ret,da-dk,3513665998,2466404822,18c52df9b86f2146c26bf8efb0df6590c59d45db,8988c87052a3a85b166a206b6da92f52b134ed5c,c,c
    ::#,2104,ret,de-de,3614791102,2578093933,cdfe971c77e508f2c28b5f9d32b4c40adb8c98ed,e0569309c49af9d9d18f60332d29fa01fab3c493,c,c
    ::#,2104,ret,el-gr,3513427738,2463424291,4bba7f208f9fe0b4197aee0b9b41d2c09d6b2dfa,7173c9e501e606be2b93f4562a9a03ee3438013e,c,c
    ::#,2104,ret,en-gb,3603517726,2556301582,d127f6ed241856b254d0ec360e0feddb18f8752a,803c8a6a437c9fa7dc5e0a08f2d5b146b8ba9c92,c,c
    ::#,2104,ret,en-us,3609537425,2560527998,99504319cefaeea632b64d7ed470e5ace5f28c31,b9b7ffff22c9827ffb55438a36d81e5008509168,c,c
    ::#,2104,ret,es-es,3610986336,2565178142,f1cfd8cfa59f057d334a7dd099daaf6b4e8676fe,b74f2188d9a347109d10b9beecdcc2d70ee0b4e5,c,c
    ::#,2104,ret,es-mx,3431104232,2431312383,2fa44e4e639f2b2f21ea0b1e813f149f5e95576d,34bd3011be7bd95a1ec7e883bb1e342a32c7a17e,c,c
    ::#,2104,ret,et-ee,3461144959,2421858633,d917f2a5d1588744023a18c7283f4aa1f5cd0c7b,bef818b4f4f32b2e01840590e8984b261c5343a5,c,c
    ::#,2104,ret,fi-fi,3490501870,2451852010,1228c8819a46073efcf21fddd6c62cfc54992f92,22a2d65c43e9ff7be9ba4fb45dd5edd4a200b687,c,c
    ::#,2104,ret,fr-ca,3426408934,2451370923,dcb81dc88c88cc095f3bef56cd8c13e0e5b72453,6cbb62bcd5cfdeadca75f7818fdfab26c39486c8,c,c
    ::#,2104,ret,fr-fr,3617796144,2561100086,1324d70a58a812b8daa07657b0724a7b65edf375,e5b71d7a5348baa5c31fe4e350909f42c0d860a4,c,c
    ::#,2104,ret,he-il,3379313814,2406041191,8b8e6c567136c0e9024ebeae2a572b9b9e2e4d90,22fb58596f497dbc0cde082c85483cf785724a6a,c,c
    ::#,2104,ret,hr-hr,3467680310,2432217514,0d5eeb7157cf9b1689d87255b0a349e2ee80faa0,a1e3d46df3c5d35c06d7cff6f41459cf3073c01d,c,c
    ::#,2104,ret,hu-hu,3476231516,2446944873,9b0ea894c56c99551e88d214d588af4362607bf8,fd6282b736849ac806932f417622a0f8ed764b1c,c,c
    ::#,2104,ret,it-it,3541259073,2493263707,5aefec0a3dfa7d764831077ebd18f8ec287f8acc,c609d141e8cd907672eb3603e16ccc9fa63b87a5,c,c
    ::#,2104,ret,ja-jp,3571126233,2589573586,12fe54fe35f78d372fce5eda31eb2095b242bc4a,baf6f90f85a83b9a37ad94cebbdaad54f39815a0,c,c
    ::#,2104,ret,ko-kr,3403791834,2418929208,8c1c364828a7835a9f3a3866bfbab795489e2268,e4bb9d37eea8c3f84f7cf4be109381e8af9ef57f,c,c
    ::#,2104,ret,lt-lt,3468228613,2424578912,a08470924085c950f7480c44489fc119fefbee34,df1ffa63c4fa4d0982841f0a6b113d246c81ab5f,c,c
    ::#,2104,ret,lv-lv,3466144306,2424101046,0d40955247a9a7711eae7231e3086a20483f2522,e2a6e4804dca68a1f3d9657c5e108e61c8ac7610,c,c
    ::#,2104,ret,nb-no,3478542750,2446777718,fbda90a18752db53e365995de3fe0b795b82a1b0,e5769e752f489843f480e13c05aae1a5cfb45849,c,d
    ::#,2104,ret,nl-nl,3486467134,2448914107,a1d08f55b01f23bac36541bbfcefff576ee4cda5,7d9ec120202a5c902dc86656375b94e8f280c828,c,c
    ::#,2104,ret,pl-pl,3510453171,2469581370,ddca3dc619575b6239992905e83eb72701b7191a,0d638f5c8ff76e11f8464db24edc0f8c36541c9b,d,c
    ::#,2104,ret,pt-br,3433400174,2434211743,912d33c9966c7e0a862aae613e2c4145589999e2,41813a714de05addaf3a4b02cac8557c25d3e806,c,c
    ::#,2104,ret,pt-pt,3535822654,2484133492,0d2421026b012068619110243334a88965712f00,51800d549e9e4a32a4ae6f404c605dfba3ba91b6,c,c
    ::#,2104,ret,ro-ro,3470071300,2430562330,b6926b751dcd58b572590116723d4241dd28c6c9,bd1020c49267307bbdf44bd826cf20faf3d3af9b,c,d
    ::#,2104,ret,ru-ru,3430462123,2439075996,15618188a00a7b2aaa68f4c6b87e08e6a4f07331,2da475bad89ef745dcdff6a413d6e8db49a904c4,c,c
    ::#,2104,ret,sk-sk,3472395000,2438053195,91676e5f331b1d81aabe71d5af53d90ac06cbcb4,9b5b5a361d7c5638890434c3bd74edcaac626df0,d,c
    ::#,2104,ret,sl-si,3467607426,2436717792,0e7ba031304d95d6202f5f3aa78f6049757b7f60,33492aeb6478317d0e9793002e4c6ef39421e51e,c,c
    ::#,2104,ret,sr-rs,3355604758,2369715360,43a28859d5ddc27fa21147571fd6ecbad9c98220,b13bb12981a58f7876ad1910e53fd9facebcb2c9,c,c
    ::#,2104,ret,sv-se,3490204035,2446984416,05b82ac7e0ad862ba29573f280c6b8b2d747d648,d5ddee9e1009b8c18d2c0d953e5c6ee17cf4fc29,d,d
    ::#,2104,ret,th-th,3365799411,2387008722,c685e53c6964b12610fe992b944ae9508f6a1075,eb1aa56bfcba59de613e9a6791c2153e8c630d14,d,c
    ::#,2104,ret,tr-tr,3366531784,2382181877,b143bb0768e0a6f4719a9a8b1467d7f9e0a9d1df,99595f2eeeea27af8f3da15722607ee8d51052c4,d,c
    ::#,2104,ret,uk-ua,3365431030,2388921054,2845ae86d8d208857c7b52dc2c65464fd76dc189,63ac937cc9626a1fb21f9c451b882ab546e58aa6,c,c
    ::#,2104,ret,zh-cn,3625775339,2633078381,16f2c8adba14b6e7b24f07f3621106d0dc8189f7,f4ad3c3fb95b343e91f0ebc7945159778b886596,c,c
    ::#,2104,ret,zh-tw,3571725237,2592639970,ca4f59345e2fec51bca8253496671c8948d68c0f,82a0b0edbcc5edf978fa7f675eff04ff925783a0,d,d
    ::#,2104,vol,ar-sa,3341084108,2375376521,7b726b5d3cf791b7011aafcd194e4b947f9e53ff,2b4b190883d837bfdf9e80d54974aa3d45598fbf,d,d
    ::#,2104,vol,bg-bg,3421952216,2404858323,d0296755e807b75e785499a900eed15506fa185d,7f2c4306e024bcc38c3bf0452c79dfd69924d0fc,d,d
    ::#,2104,vol,cs-cz,3420160791,2398991746,884398308ddc9604f57add32ec182bb2efda940a,6a34fa7e86527bbe740b9e85264dec3f3928d3fe,d,d
    ::#,2104,vol,da-dk,3442516700,2415701476,6a4a23ebdf5b3e6358afb9cb9542c1263a204072,e39861e1a1ff240ba985aa5658062f4bf5693d89,d,d
    ::#,2104,vol,de-de,3552197944,2526545564,aa63ebd64db00448b05fda53986fd62ebc2c095a,12644ff169aec3e5f915683174c3e796e84352e7,d,d
    ::#,2104,vol,el-gr,3437280956,2411101034,cf43f46e791ed33385608d6e62f50b8b321301c4,2ffc231702c1cdb054c984251f9b56085625779d,c,c
    ::#,2104,vol,en-gb,3507237256,2488309969,324def1a416eddab9061aeb0090bd3fb17960aa7,dddfcd8b502c82a1cc87f9587fddccf0f12be3e4,c,c
    ::#,2104,vol,en-us,3509875534,2493281809,2135b936d88de16cd585b27c4707aaf1876f0081,93c71567631d41427e0fb609e1cd94a6baae162c,c,c
    ::#,2104,vol,es-es,3514853106,2494311510,509f7641f6ee40c568462db30de1bf9919876fbe,d14909554b7386715556f5c690a758a52b607359,c,c
    ::#,2104,vol,es-mx,3342179694,2371282915,de0a1c6b8554fc27908ee580bd116b036238fa98,3c94bcfaee9a58f55bd8db0c62826db874d65ca0,c,c
    ::#,2104,vol,et-ee,3391418350,2375949998,8497846e8c1d9fe924e96eb6f34518ffb6355a06,8f8c3413473031a6c40990fce69ccc40fb37654b,c,c
    ::#,2104,vol,fi-fi,3424627794,2401706988,85d821b199805aa16423ae1891972fa4cbec1cea,aa42bff68443d235549a6c3d7e51a28490eb89d2,c,d
    ::#,2104,vol,fr-ca,3374111900,2412293393,e7eeaa36c1d9d64638fd612841d8d20e1db73450,5c93ccd68ad26a3259abe4f62cea81eb37e49999,c,c
    ::#,2104,vol,fr-fr,3517970344,2492933272,06dd9261ebde2fcb39adbca839225fe1058de232,6e8db2685c5c3085d167cb4f9c7068cf9df49637,c,c
    ::#,2104,vol,he-il,3329516504,2365577555,d1d5bd55934c65ff5cfe07731dac2b99126700b5,093055005b7a2b2876afbe1c1e712364c601841c,c,c
    ::#,2104,vol,hr-hr,3395247379,2380408356,8e1b6142338cc8eb2f66b261979a9d560ccbfca2,94cc66c2a7a3b3c600ae0f56544a28c86f88084a,c,c
    ::#,2104,vol,hu-hu,3420565423,2392924152,7ab613b7a735ad0f183ddbe60be43fbe32a2e9ba,94c94eabea572fecffb4175b93a3a1e6678d47ca,c,c
    ::#,2104,vol,it-it,3472488509,2445623938,e9e7dddc94c71d3fa6f533c7e24418905087849e,d58141af4d15a3e7385c8224d98d30092b0ccd1f,c,c
    ::#,2104,vol,ja-jp,3517231294,2549317356,1aada86bb01c4cf439e18e0ac2d0a3a716bc5f5a,bc592b392602a48001c09f256f611188f7293001,c,c
    ::#,2104,vol,ko-kr,3344813066,2375057201,85f2e8942cd15804e55888ae0597756d7f5c014a,2963bc8602354545b32e946733a4d756638238a1,c,d
    ::#,2104,vol,lt-lt,3393098086,2375151446,4169dca3d5bc523b1a3c4e96b72bd8d5aba42143,737ddfe6a0d5e9c391acb3574bee3876cf9184bf,c,c
    ::#,2104,vol,lv-lv,3392012200,2375795382,5065cb9bd3311bd9d1c32f2028f42e1dcef83d4a,ad12046ceaed65a8bce4974e1fc3f58b7f70e894,c,c
    ::#,2104,vol,nb-no,3415496264,2393425310,3080d366ec4e501f67e03f9617acdf38b9c96bd3,71900c76e96e7c1d5ef7ac52c608a3b668ab0832,c,c
    ::#,2104,vol,nl-nl,3419245622,2397302280,f6ba09cdfda0ffed7009f64c304989f84d134be0,ab526e32456203ed00d5d27de068abab11da6b52,c,c
    ::#,2104,vol,pl-pl,3440364700,2418754350,e9319ed0e89a1192ff0d826fa7fa36f8e510ef5c,4b7633e3d28cf2276e5a5b9695d8306c52a5b80c,c,c
    ::#,2104,vol,pt-br,3345850040,2376304550,90014f30ea8d2af2910d2a224bf07cd0fa56d01b,f2080c942d0af9da977f222d9a63d739b54f00b7,c,c
    ::#,2104,vol,pt-pt,3443097496,2416031504,b71070a09e0c28732c0bd65b9220a8e76047881c,2a927bdbdd1d25e9c8cab6f77abe5cfd850de677,c,c
    ::#,2104,vol,ro-ro,3397184771,2378288782,0294ccd5361dd68564df06b15f5861509ff42f2f,c4c8b2fcf01e6e93c75feb9a203afbf48ec7ba48,c,c
    ::#,2104,vol,ru-ru,3348430457,2376559456,3be190a99ff7c8d5c07f684dbf48cbd15ef8d95c,ecf956d818fb51e09537d7ce01a4a2811d814a7f,c,c
    ::#,2104,vol,sk-sk,3396387777,2386130552,76d03095b441d6e6de3dd060eed4edc1e7fd94d4,d61fa69bab745a05e2e88dbd529b6c583728164f,c,c
    ::#,2104,vol,sl-si,3394144727,2383526433,57e6df99eef2fbc7727829f477a358370b3923e8,790ba45494fb6e6504a184a4bbdf85ecc7b96650,c,c
    ::#,2104,vol,sr-rs,3268732574,2307209874,befa48a8f84ea27df6819ea6aa030162669a0186,94b56fd50585acfdc4fc7d0cf5fbe56207250d34,c,c
    ::#,2104,vol,sv-se,3424841494,2398611714,e8f5aa841e98da97cdccdff52dc548bd1d0e9922,4034965de177ea90d0eda0405e10d81239ca882d,c,c
    ::#,2104,vol,th-th,3287839483,2326053312,89e06fa89fe3cf51471c22f6506e4dddfdc66b37,05bafc474f9438fbf4363659d0bda20282c463e6,c,c
    ::#,2104,vol,tr-tr,3287347870,2321505852,d014b23612b3ccfab23b92f8780d13e9d4e1d9f4,9e185aa9e01586d95c3b2e88d6dc29fd23126f24,c,c
    ::#,2104,vol,uk-ua,3286940134,2325136249,77319b2abf7e3b71b23b172eae57e7ecb9013dfa,79cba3f9db9785630bc5c850a3693f7304ba1946,c,c
    ::#,2104,vol,zh-cn,3537934417,2572165582,194c3263269f22283e1d8b98265d03ea3ef03127,cff8cfd761bf2d52a5fd35c57104ca2157f7bab0,c,c
    ::#,2104,vol,zh-tw,3513037723,2550894991,D90D9F422BDBC7E1D13CB6FF50603A8887B3CF78,9B788763FD0867BAA7EC2FED3CF3CA9843A48A24,c,c
    ::#,2004,ret,ar-sa,3424376474,2443826666,b318889964b75cef3a69ec75d28c7ef174157fac,34627c10a75e32440b8655fce3fa160b2561f81e,d,d
    ::#,2004,ret,bg-bg,3497891524,2461077962,89768c1292bb00d8bc59cc93a8bd31bf86fd0d60,b445575585fafced162431c8e491f35b20541083,c,d
    ::#,2004,ret,cs-cz,3489284116,2457579642,47089fda0dbd90725a7de74dcbe18edd8b10ffd5,b5a47c13798de6d47e39d82795d300c826e3e9b6,c,c
    Original file line number Diff line number Diff line change
    @@ -1,248 +0,0 @@
    ::#,1607,edN,bg-bg,2779059020,2111252165,7a3b8f8df4d678a1e7a34e341fc7d5618ec9a246,66cc95cd28f00e40caee6bec7d5d70a8fb5e773f,c,c
    ::#,1607,edN,cs-cz,2776622382,2110545610,ccf1326afdb7d2641360f79e096e49c6a38ffa32,f1a9bd1559dc919bc370f4166ef8ad86f10d73b6,c,c
    ::#,1607,edN,da-dk,2798017588,2144210086,7406eda1d78d6f3a7e8a1bb6370daeff8a28821c,497b443d71e65f6a63f01fb7ec61c53b8bfbdb6d,c,c
    ::#,1607,edN,de-de,2887254906,2219606526,64b3d9d55cbda469d5228ccc9156cd0fc23e04d4,9213ab89e0c17890d3a9151fc79932a587f3ac52,d,d
    ::#,1607,edN,el-gr,2797909794,2124151984,6d69df40a7294e47c4e1ed4dd97407df71e3b579,94e7d1affe714552cd0d5dbacbd49eb48f3f1fbc,d,d
    ::#,1607,edN,en-gb,2856936794,2200062104,1178f5a038534a6db054c0587795827c8174a3b7,3eb8ee29ddf22f0347e51c2dc0b6e244c988c9e8,d,d
    ::#,1607,edN,en-us,2861204596,2200128810,9f9054a5831a86799435742b96589d35556e0b33,3245de6b32dac4fe753a29d77c4d5276f752a9cb,c,c
    ::#,1607,edN,es-es,2851148850,2196419238,9ce4a7149f1c83547a093c77e3a054be2facd930,4ed9dcd6d9402c53b7c0d7ddadf29732ccd47ef3,d,d
    ::#,1607,edN,et-ee,2747120942,2096054254,1ed1164e84604f09732a9837adbcd27b45742d16,1edea61b5c9f927bb86adc4eb4b64e65f565f5ed,d,d
    ::#,1607,edN,fi-fi,2798444234,2136693992,9798bf4f02717618f71ab3ec9919e4c304b24ea8,8299144245d06af58bfb1787897e2601a4346bd7,d,d
    ::#,1607,edN,fr-fr,2851527218,2198063086,b80067fe56f542be1e2262fd1f93ed9bf45de7e6,d67758e1aab4ba26e563c94c9e71f02bc8b457ce,d,d
    ::#,1607,edN,hr-hr,2768580546,2099953642,35d1a05b4f329e42e0d16930b6cde4122c40f765,d9037e29d6981d000643004ac770e5e1eccfcfb7,c,c
    ::#,1607,edN,hu-hu,2782140028,2116985906,1a108c29a93bc32e4a1fd28c73e99ca88c5fc1c0,f45cf9ff9c019ecaa9b9de14252aa950bdfeed91,d,d
    ::#,1607,edN,it-it,2811926886,2145186280,7521153898da230759cbc5a3b7b6534d3a378ef0,e12aaf53fb3b43731394a90b052d522e53d4c3c8,d,d
    ::#,1607,edN,lt-lt,2757803852,2095722632,f0385e16fa913fa76719383e850d1d35070a92a8,e5d410dee7dc702f1951f7a7a8a86590f605b302,d,d
    ::#,1607,edN,lv-lv,2756086022,2095036762,7792ef1b2b8bc3c5b8c217d0748da5b8a23eea07,e41ce56ea65c5a80aae7aae51409c8353c89de3d,d,d
    ::#,1607,edN,nb-no,2773327388,2113411140,ff125d34aecdf49b9d1540d6061cab57dc7e39a3,d0fb7c0f30e00ed68322a56f83502a84ca512b7e,c,c
    ::#,1607,edN,nl-nl,2777477440,2122186926,e4d76ea47cccc8d3c917d5d86325903a9759e1f4,a71e61b4fb3a53e6346cdfae4d0a509b2c59b712,d,d
    ::#,1607,edN,pl-pl,2781418062,2121400542,b15363bc8841f93b28d285220a9ad7786e1ca9a1,e03523eb6a1426ac02da0db90e90da9ce24f242f,c,c
    ::#,1607,edN,pt-pt,2792216100,2129997546,b7810c3c8ca4c1be162ea5cacb8eecf5f90161c8,af38dc63a255f96722417a390bb29625bd5f2c0d,d,d
    ::#,1607,edN,ro-ro,2764183386,2098687326,cabebb3cdc5c3e11f839942ce96f76ebc24f14a0,7fde1bd5b650f7bd1b39da2c27a6cfce05cb58f2,d,d
    ::#,1607,edN,sk-sk,2757427958,2096928490,3abdf61dec10498ecd12df2570bffe4d11109e3b,f77f86e70b997ef156cdafa5e3927c24d020751f,d,d
    ::#,1607,edN,sl-si,2758340722,2096845220,e5b73905ef2020efc1bc646abe87a3ddd7dd7bf6,c1319abf345baf4c95a35dfbedcc0e3b9c206a59,d,d
    ::#,1607,edN,sv-se,2788498688,2130648134,fd2fcdd512f2b38c3791426b3f8421b1041a9e0f,19d90b982ec2d963667561718642d3dcf2497cd4,d,d
    ::#,1607,edu,ar-sa,2956949156,2254502852,ad209ddde42bb7c0dbe62aeaa56c9edb1e21374d,d7e56ec015c48a9ad24671c6ef1d80daea27f189,d,d
    ::#,1607,edu,bg-bg,2913342796,2227290394,d5c152271d498675f400eb335c7f20c8f05cff0d,225b91d09bd7a639fdabe14b7a82bfbb7abf5ba9,c,c
    ::#,1607,edu,cs-cz,2917449894,2213609352,abb6ab1ab0b5a9f9c715d1cf91aa473e410eb958,dbde988b353a76740e0576b53005cbd5861ef1c7,d,d
    ::#,1607,edu,da-dk,2945166370,2249489774,4641e22dd93423212b5b465db1c4b720921ff737,2a892143d6eaa1dcadc8720eb890a1db7a03b28d,d,d
    ::#,1607,edu,de-de,3018157658,2319600702,352e4a7510e0ceaf1d97f03db3579af3e0344938,a691d8569c4dd10f4831d8ab9c9bd87d7b3b918e,c,c
    ::#,1607,edu,el-gr,2934720002,2226151718,93eadcdc4ea4b3c9464de64898fc172284ba3d24,6c7b921c6798ff2a8128bcd6130962f923064642,c,c
    ::#,1607,edu,en-gb,3001730482,2303122652,d363257e8203c0b46c98bfbaeac8e50d6d762f91,6542537ae4a5b1d76c2f7658b91ccfdc84005dfe,d,d
    ::#,1607,edu,en-us,3014778678,2305264922,01e49055b446024d37bdd3ad1711a8b529bc98df,fe55e8afdcc571f8e8fd5a42cfccf14790d89cbc,c,c
    ::#,1607,edu,es-es,2999917512,2297447302,8b396b404a5e68b22570bd9d2c7bc23e0cc2fa89,6aaf073db8890a7c6aa6214633bb345cbe9a82cf,d,d
    ::#,1607,edu,es-mx,2940854936,2245392276,b16befdf9f8905fed73836a03a1505968b2aa583,79d8fa9f21f4f689ff2315d669e584058c407b69,c,c
    ::#,1607,edu,et-ee,2890533510,2190464570,6edcaa2167c569b5e3dac218f90161f686eb4ea0,7b4c97f368a2673f751a9e1c98a79a65ec846b74,c,c
    ::#,1607,edu,fi-fi,2936951164,2232027472,88e07bcb494c2973a37eb32c11c6b2f6f313d6cf,44c3d9b0f171337f3e83cd4b16b9fb04875b47c5,d,d
    ::#,1607,edu,fr-ca,2972513666,2268537776,99dff3ff2faac319c38b67adbbf7df11b996e2f0,01a686ce606798e63eee51111ba600f832cb867a,d,d
    ::#,1607,edu,fr-fr,2993414936,2298742674,c4aa11238240f052fc155a69add5aaee5a8fa2c1,e9e686f6bb0e5a2bb463969aee1ea0bec3cafa16,d,d
    ::#,1607,edu,he-il,2919856152,2225234406,ccd6fcf5bba100f8bd7416b8368ae88986d42719,135c9d913514fb9ce8c0e3a11365c1f7ec96f7d4,c,c
    ::#,1607,edu,hr-hr,2893579680,2203786466,373e5f74e3bf90e1e40597b2907a705cf7947ab6,a97c9fd5d866cb6b49f5224c0e227923335b071b,d,d
    ::#,1607,edu,hu-hu,2914578404,2219026456,9c2f593daf664ef8b2424c9b85ec981d957b96b2,24e79499a39c3f658a4721f0e64fc99f80eb71e5,c,c
    ::#,1607,edu,it-it,2966090488,2247919526,be99f0766321e460a071d50083a758dfacc64923,907c1dba70eca9011e7a4c087b76edd7d4ead76f,d,d
    ::#,1607,edu,ja-jp,3061128986,2356394260,02e4b9da921626da3d03c0a413ae76148dc0f9cc,6511fc807e5213138c36abe22ca4b9e7c9e43dfd,d,d
    ::#,1607,edu,ko-kr,2966153026,2259563116,77018ee745ebdc581693dcaa9ec8697b5605dd3b,9e869188c0d903fd0d982f93076960383d6b608e,c,c
    ::#,1607,edu,lt-lt,2886584406,2195909696,afacc60cf3c558d94d01691f896a303cd3455651,593f59fabf626765463001023aff98a29c98e713,c,c
    ::#,1607,edu,lv-lv,2884763892,2194102206,f36bada74914782fe174d92bf82222e7d5d61488,d520a5c393fd148b7e0af4fafca9e7381b5981f7,c,c
    ::#,1607,edu,nb-no,2918231688,2217842192,330597e50d041b5f9e1798671aa0857ff9dc2e3a,98468450afb526f4f16f5c791ecad934f1ad99ce,c,c
    ::#,1607,edu,nl-nl,2929881030,2227957810,5fd638867eae87b871fa1d0e393866698eda8514,1b68236863ec2782377eb23c4897fc371e5d082f,d,d
    ::#,1607,edu,pl-pl,2930550878,2226921692,3e48dfc45ec6551ba7b67ae6c965351e5b0c6263,d2e0f7a4d26c8f52d136d7bdae162075edf70757,c,c
    ::#,1607,edu,pt-br,2952864672,2254176436,5e453b92f20a8713b7ca6ecc5c2f2577cc67b58a,34066ad64f0066280ebde3b7833f89c7e468212b,c,c
    ::#,1607,edu,pt-pt,2928144706,2228686892,6135ad949cdfc76b4ebd0375f83ffd49ea09d80c,fe0f33f8faeffba3c3a059660802d9c44936c801,d,d
    ::#,1607,edu,ro-ro,2904204054,2203396506,1d231962d9263ea94c7a094565cae9e22f95e645,3787c9449e922cff784347f436f0e10b11c83588,c,c
    ::#,1607,edu,ru-ru,2957672236,2261036400,c5496123d5f1ed75a8511ea6c71c958bc38915c8,e01b56432419748e3420926222512f8b464509ca,c,c
    ::#,1607,edu,sk-sk,2893555152,2197058184,07e05be074dc12e411b3d1c5cd144a210b70e869,703136264909e5333044aec874ad6fb14790eedb,d,d
    ::#,1607,edu,sl-si,2884411810,2195839708,6236323d5ddce9c6d1e5673c13ad2232d8d8f1a3,a92efb6ebe2225fffca570d46b9bde4dcba732f9,d,d
    ::#,1607,edu,sr-rs,2891648167,2201558184,534d4a85ae9a935f7ede65e352252ad27e90f21f,8d504ce35fb48d0e43e4b0129f80157991f93727,c,c
    ::#,1607,edu,sv-se,2942914320,2230458544,67ee08ce7dcdb02cb063a40129afae15a5e7e774,5b7f3a60a484b8ab7ea57629974a6df187bdae48,c,c
    ::#,1607,edu,th-th,2909426878,2216567444,c341908be3ecdbe7150a763b900cca194befe662,df73d20b5559e717b965b762741795630a253877,c,c
    ::#,1607,edu,tr-tr,2917813760,2215387172,3cef4a469646dd673562a2990c6fc99c1d57af3d,e53d36d75762b89914ee1787e220ac10dfb5c5f8,c,c
    ::#,1607,edu,uk-ua,2913314734,2220722110,e7e3090d392bc59e15da7a49be08772a15d5c2c7,b70d87de530267e650ae34b5b29b5a316d69cde6,c,c
    ::#,1607,edu,zh-cn,3137548350,2421638284,120476969142efd3701de14d140be47cf84d92ab,32e7d27d988f97b5b77e2a371035c9b80ee23b48,d,d
    ::#,1607,edu,zh-tw,3058815872,2359003730,57c2708dc6583a3ba6005e04934bc07541626da2,2237f1fb22a928df1615afffacf3bd916a188728,c,c
    ::#,1607,prN,bg-bg,2773968628,2111630422,fc329f5b4f683d6c9dce6da8ab12254f4aee79a2,ef1cdac011e2796516bb2ecd489f5a95807db56e,c,c
    ::#,1607,prN,cs-cz,2773293502,2111595264,c8c121aa245eebedef4142d86e8c444c82eb5ebf,c2fb76d2890cd7b33759d070bd4fa9daed67839d,c,c
    ::#,1607,prN,da-dk,2797523030,2137463158,01fa575f4e02f6d7b63cf02f691cdad8b7d06385,6f3a269b3f46310845cc4671753f9bb5e0c53fbc,c,c
    ::#,1607,prN,de-de,2887386902,2220146562,dceb5a8fbefd5c891523cdaf7d9ef85ba78648ca,bfe79458d02aeaffbff01df43e43af6cff1086a2,d,d
    ::#,1607,prN,el-gr,2801821428,2120864956,33997af7aa98ddf701dd77a197a01ada0083cd16,93a91f0147950b7a92f1b52206d4185d5fe2adf7,c,c
    ::#,1607,prN,en-gb,2859609418,2198424742,91815f5e30a2b75891b396c8a0b2848befaeb46b,00f726c42be7c11b5fa7761cc26f9957880d1324,d,d
    ::#,1607,prN,en-us,2859983836,2202017206,eef8273e5aff097f031d3eced6081a2ff1ce6e70,5e29955a7ce81907f0d90f61ef0c87a4d5693150,c,c
    ::#,1607,prN,es-es,2849603408,2195845498,28c0c3facdee14fca9c415baf12e852424cfe823,cd2c62a7e75b6d0afe39da402b63b1f042b2ee60,c,c
    ::#,1607,prN,et-ee,2749178492,2095309794,956dcd0e2e74458d9c530837e76e3e85c87569af,618bb7a7e6305ae5a4ad05417c1d7a6d1c240d94,c,c
    ::#,1607,prN,fi-fi,2797659170,2136318712,2bdb6ac2dbc58954f7cd24270fe3e90284e54daa,8c673bcaf88ff3675573a358be304962900a6971,c,c
    ::#,1607,prN,fr-fr,2851575648,2199089480,2911e901d843d85ff7d4d8a26df117c915739d1e,eb7fd4ca93539d05478dec8ee088184df9ad340b,c,c
    ::#,1607,prN,hr-hr,2765117444,2100765434,2bb2b9c596d7c58a152533c0f68c193dff262f7d,90a92a7b6a6ca30d4e0b609178c9aaa49c0fcc28,c,c
    ::#,1607,prN,hu-hu,2782768444,2121777568,650ca39bc961abf7798fa7877bd44bec042426a0,7407a410bf6d9573cb22b06cc98ea8467f0df658,c,c
    ::#,1607,prN,it-it,2800506190,2144659586,63287c51ff616254966ed37d52ca9300cbb12230,f4863cd0ecf5bfee974b9c423c9d864e9bfba3b9,c,c
    ::#,1607,prN,lt-lt,2754636784,2094530112,33ce1e39bcd256df8476f189e5a6a051de49cd13,e2db5267355217e8f572b6b482b5b15e0ae85121,d,d
    ::#,1607,prN,lv-lv,2755350776,2094597898,fb774f04e2f477d5060cdf15ccb67a57471a5511,a342940c936e67f0f93c433c935b868d58d8867c,d,d
    ::#,1607,prN,nb-no,2772100158,2113869760,c1a2d7a1b2a5215831439f80a716768eabea41b9,c850d7cc8aa9b5c6a1f443efb313482c9e01fa12,d,d
    ::#,1607,prN,nl-nl,2773104714,2131740526,e363e17767440f8c902e96ab193c926610ffadd6,31f1d6c1735d862d9c4a5aad54983b9ac691dc3e,c,c
    ::#,1607,prN,pl-pl,2780436314,2126498562,695623b0a4f468c1dd7c5807faf84dfc9b9356f2,947f434e5f736374f797083686d156ac31f61cc1,c,c
    ::#,1607,prN,pt-pt,2788551940,2128468318,5d54830d399eaee9d14223f9085684c5182cdab4,76f04e40fda45dccb6d056d3a3ed629f3574f0c1,c,c
    ::#,1607,prN,ro-ro,2765807026,2099203004,d98b84579055ca2114bb86390def6a06d4450e40,c399fc45669d57ea42a650cfa1ef9cff42aa6315,d,d
    ::#,1607,prN,sk-sk,2762718640,2096757828,fef5249e7b211a31db3c756f8746cc69093b8f89,24cc2caaa234990688701aa259fc99740f6cf625,d,d
    ::#,1607,prN,sl-si,2758415634,2094438534,ac0ede2cf10e95a905f4070bcf08651625d8cf6a,0bab0901bdd35b2e1bfa11db4d31aa835a79d39b,d,d
    ::#,1607,prN,sv-se,2797681810,2129967952,1ed5517d01de32c3cc1f77cdecfe4f356c0d94c8,7b3ac33040f23a1d3ca949124aae5035270f0e0f,d,d
    ::#,1607,pro,ar-sa,3017152712,2316041282,763f8d3532a4c3d95dddc0239ec6999c6c063c43,1bd076aea51f88e19c600d34d06050f78e87099e,d,d
    ::#,1607,pro,bg-bg,2968435508,2285063890,c56a9b9f6e7c37fc548686835755676ea04625d8,d9ff9494d106af25bad566591933e20f3cbb9c01,c,c
    ::#,1607,pro,cs-cz,2976799184,2275903108,4ac0dbd8eb31b90ea7b500083a1a71f9665fb677,f721cf9c925e778ab8b0014cd8727156613664a0,d,d
    ::#,1607,pro,da-dk,3009307712,2305464234,a15c3a85061a12b7cc9b366157bb9fbc30d71aba,e830209b7541756470aa21ebca191dfc6ac39561,d,d
    ::#,1607,pro,de-de,3219035316,2495166956,dea2c577e64546463080a96c4b075e924a60d412,968aaf9107ec3d486f1125a109a1ade30cae07db,c,c
    ::#,1607,pro,el-gr,2991041138,2286941358,4f9089bfd9b0815116fce8ee104a07f445ab82e3,6e029e44b04367c7f684888280b52666f999b47c,c,c
    ::#,1607,pro,en-gb,3176583254,2476842804,db057a5eac7cb0d65691e758f3949c13f26a513d,21fb6904b75427ffc9e9d3fadd3e0df9a4035598,c,c
    ::#,1607,pro,en-us,3319805853,2602533592,a67fdee4fc4b5703b4ab599a5578a2dbe2f655f2,d91e124cbe2bfbd372a936a401bd462f4773ceee,c,c
    ::#,1607,pro,es-es,3089825090,2370591066,8428460416a1effb60b2e204c40c436cef439727,b5af8299317ac3398e93a122b06c846c4e18b6a5,d,d
    ::#,1607,pro,es-mx,3021626512,2339980484,0d6d30912e3cfb6b05481a8dac29cb165d5ec531,205d7918b164275b9fc747dd05d9bf3d5d82272c,d,d
    ::#,1607,pro,et-ee,2947223572,2250794742,736038bc59a7adbd86622480076d54c916ca583e,e39b8aebf84482322316e54a8e7fc03b200d6b5e,c,c
    ::#,1607,pro,fi-fi,2988097106,2294397954,894658288a4de3bdadc3c92caafbc77d6beaf8df,5a5a127d2b9f67eb076b2bb8a8d05588ab33e41c,d,d
    ::#,1607,pro,fr-ca,3057151984,2340335032,b7af8f72ebeb77a7529a91ba82fa96b5d7c1aca5,3921cf2651b9bf40729c503f59ea39dadd67c1ca,c,c
    ::#,1607,pro,fr-fr,3151088370,2431461582,fba5faa2d2d3c656a6e2180be4aed091e179dfbf,52c657286188ae0ff2e4dcb9e19238affbebdd95,c,c
    ::#,1607,pro,he-il,2988102890,2282465040,cce395f6f1ef65da5a9514312f7988fb975c7aab,294bee60f7d248b6766c331ed6d291f23cab54f3,d,d
    ::#,1607,pro,hr-hr,2964453442,2265497235,c6a879a1bde4828296073b45bee522a530fde1ce,453579e6e76c81fc72a2b78b554c8cafaa4a23b0,c,c
    ::#,1607,pro,hu-hu,2976155974,2284059150,952368f507a15afac4d0c4c42697c36794c57a28,237677d16e6f2256687a02e2c07d44042ec4a5c6,d,d
    ::#,1607,pro,it-it,3027424610,2312619924,ac52981de1ff7d7f7b8e8d2a4981130dd9b7062a,86b071f191f5193270378258c69814988df0f10f,c,c
    ::#,1607,pro,ja-jp,3249832189,2526997792,87dc289be935d27958cf49f9d97b3db6f2d69721,f7491c42d0d64688df6630378657cc2bf725e89e,c,c
    ::#,1607,pro,ko-kr,3053846230,2337854332,9f5180fb3d8792b87ee078df3b64cc1504221b0b,6639d29ba6934b13bcd5bec97a10cdaf1cdd30c7,d,d
    ::#,1607,pro,lt-lt,2959202730,2256006622,cd7650dac53a9f94e1556879d30ed5965a0703eb,1d142359840ab83fb067468cbb295845d07db385,c,c
    ::#,1607,pro,lv-lv,2967916812,2260414882,060160161b5ed79d53a3bffa7fc0014806664979,2a3033731f8b28041fbe193a3f718cc62a301e6f,c,c
    ::#,1607,pro,nb-no,2986394866,2279262560,80dcd802fde6998d7f82d9e34457d29106180150,5c5e576148999231f138597401cb14f25ea15829,c,c
    ::#,1607,pro,nl-nl,3005059082,2301425470,64a639f0066eed9c454e3e33451efde18dd6ba98,823da75e12b4688f0e08acb6efa686266c91d3fe,c,c
    ::#,1607,pro,pl-pl,2988628234,2284329308,953d0e942518a30e8e98fd1dea151926fc8944af,df3a74d6bd322219e33031e7e97c7ad7ac503bc1,d,d
    ::#,1607,pro,pt-br,3030217044,2337652576,9d925ec3a182e0c2822e37900f89bccb79c666ed,70142b3f23e729829b377ec56941cfa41c723204,c,c
    ::#,1607,pro,pt-pt,3007507556,2293680178,5cd6a59fe21427feee2a34f825f8783752c23d5d,b8b1c20b0cc4383b54c6547f295ad8e8a7897d2e,d,d
    ::#,1607,pro,ro-ro,2955444630,2263202628,b15bf61a558013f5202cd175308979af0a95d49a,5ce741cb144a804e2281c8476f9c65f0b4a1594e,d,d
    ::#,1607,pro,ru-ru,3039587116,2331906278,f27830fe80f8a1f56c1d492d1007f63363ff69f5,517619490219771a44196bb803dcc099110d9e05,d,d
    ::#,1607,pro,sk-sk,2944655478,2258865734,ea535aa8e2d891fdbedd9cd6a7d261c91280e495,eff3680bbbd0b45f27dabf4a054606fd78b30422,c,c
    ::#,1607,pro,sl-si,2941825400,2255942595,50c210f92a64a625d320fbe704d1e2d0fe129dd1,736233c3b0da875665d9fd8abd093771352d4608,d,d
    ::#,1607,pro,sr-rs,2972572460,2264817096,235a4d11b0346a527f34e68822b0d08af5637323,2d44d42cfe870638ee5d517da54f3286790decd4,c,c
    ::#,1607,pro,sv-se,2996962528,2303368688,956f1c12d67edd9ca19cf26a9b871610c4e51758,9b7ad348af69829d1adb57d12f5315bda42f6ecd,d,d
    ::#,1607,pro,th-th,2976849192,2275252504,64529e2290a400a605093bbf7169060ac0f9bbbb,2676ce00bc5b187ca87dfbae04226471b3bc36ec,d,d
    ::#,1607,pro,tr-tr,2975807725,2276829342,65612b0b4ac01f1bb2fec7b8a161ff31b9bf7ebe,250c7ec09eaebb90681467d906ba22f5aab890c8,d,d
    ::#,1607,pro,uk-ua,2981529906,2287688882,3d2b3939b2f60afec719c89443b170c48fba83ac,47ed1f3b95a08c706e13f5b4afb5e4ae0173a56a,c,c
    ::#,1607,pro,zh-cn,3203380142,2492418640,efdd42f9baea736aebfb443922ffbd0de4b0e2b7,bf32e2b319724e7fc6765330c55888cc3eda6637,c,c
    ::#,1607,pro,zh-tw,3136948712,2437070118,ec6068642e34a049a9bf9ff79ea439722fe6bfec,e80465b8395ca5afe4a3002519d2f100514f39eb,d,d
    ::#,1703,edN,bg-bg,3062413646,2343495134,a9b6ef650c85369e3a4f3f7232fdc7749ad0bd47,76ec0c3816f8ade33ffeee9615450467af80ec7f,c,c
    ::#,1703,edN,cs-cz,3062757590,2339079508,9e43e3051c6142fe660ab4bb3c9318750cc7de93,8ad87a656634d89236a6b32418e615418d5045d1,c,c
    ::#,1703,edN,da-dk,3063187452,2359142738,aeea7197285823c6c337af2d71ce8f922ff03bbc,2dc2a60636d961a67eb9496cb621113dcb582ef8,d,d
    ::#,1703,edN,de-de,3174260636,2468099010,fb0ebc0aa2ec1df782f6d5a5f18202df98907153,f4a2ca4545ba6a8166d4c3421849b6cc1fcb35d9,c,c
    ::#,1703,edN,el-gr,3067640890,2355660782,d4185e6aa65f5679fae8ae794ca94e75ea843016,d26d6de6ed08658921e5b702920370090e8b9592,c,c
    ::#,1703,edN,en-gb,3137052746,2426880828,0d11ae99ec511df9f9e61f860737dd1fe30b4206,14a1c43e4c7d7cf5a169257307395af0ef2e879d,d,d
    ::#,1703,edN,en-us,3139755962,2430993824,d534aa4085bf14c3df828c5af83032b79cec8bf9,88743dd5e4c3b6d8ff2f6339c7a59d535f776b90,d,d
    ::#,1703,edN,es-es,3146456906,2439392666,233790bf41149c751d40811dbfa9c64f83553d8e,22593039f6029ebce3946a1a37292545b45071ae,d,d
    ::#,1703,edN,et-ee,3031709940,2317447208,643c5c146cfa48609ab76e718b08049fe371100a,cc868eb008d71ca38fc236e745cf5e27548c4bd6,d,d
    ::#,1703,edN,fi-fi,3061874646,2341874174,41898f06c71bba38c74c5c501f4eae437ec41695,b5ed3b76897eecb07038496eb78dd05b032dce97,c,c
    ::#,1703,edN,fr-fr,3132546598,2435002592,340507bd08c569ad54e992eaa20bc5b094887bab,2ed1bf3706a82495959874e91b2a3a06e0a9e7b3,c,c
    ::#,1703,edN,hr-hr,3032743718,2321673434,1af71d7b368e2f0fa31bdc415f9a59fc7d1490df,c18c5d1e09f39c547cc4e4639915f78f3161fe0b,c,c
    ::#,1703,edN,hu-hu,3055842566,2341763976,2ae5ec7d0ce1566d5f1981d2e5b0c8f19b4bd24e,55751ed59fb161d34ddc3644f3722ae15dc424aa,c,c
    ::#,1703,edN,it-it,3099583308,2384149974,ef21e54b4149b2fcd67805d966fff614ec6a23fe,0e57750ad4aecb20870e58d35c0df1f76d494ddc,d,d
    ::#,1703,edN,lt-lt,3028908668,2326483892,bb5814b37ad1c338ab6fc73446d255e4a0134ab9,5d7619d4af7279b02bce8d4fe835205ffe470ffe,d,d
    ::#,1703,edN,lv-lv,3028644192,2324302588,0ef2a40575f7cf5110609b53d454e203145132f9,6b430483aa0af8073b3a79f3ec217a71c8e394f3,c,c
    ::#,1703,edN,nb-no,3058575164,2337167608,66f8d9a1a6a8070eef3f80d00df333d9df61fc43,eb0d9b5b9a8325b13f264b14f7e7e1f6b99eb766,c,c
    ::#,1703,edN,nl-nl,3062067296,2341747004,48c9f2807b869bb00a9ba1241424a38f95612ebe,146caf1f3bebf1be99c72c759ae57d033b159da8,d,d
    ::#,1703,edN,pl-pl,3080456656,2364261192,25becb5821e972dd606bd9155740a99ae7180a1f,6533b22e8d6ccb7867d3d97a01b5cc9e49e33541,d,d
    ::#,1703,edN,pt-pt,3076125224,2357048280,fcb4cc8a9defc6f31971aa681bdd04ee735487a7,0fafeb7203697a8d61a0deea890321b3f0d89d16,c,c
    ::#,1703,edN,ro-ro,3029460788,2329099636,ec31c6800ea132e93dff86efd58a7843b05f20be,fc2cb8041993259d5472a13b561edcdcf213e54a,d,d
    ::#,1703,edN,sk-sk,3035148714,2330490226,d3f1058d8bbbc21e81f1047a75b48b4cee0630e9,07d3014138819d9681c48c5687be4bf2d75f26d4,d,d
    ::#,1703,edN,sl-si,3024798576,2321416078,e89e7e320308935f183c2b7a7e2e7cf7172511e1,f25df37d61c88d58a7d746d6ba6159db712a70f4,c,c
    ::#,1703,edN,sv-se,3061608074,2340666742,0c40567e9a5e8d720ed6edf05a0cde9a17bb0415,ae6dd7d66db41d7683af5157459bec97824535a3,d,d
    ::#,1703,edu,ar-sa,3251847572,2492824508,75bf847f81faae21d85ce27bc2ea5081df25cdfc,4cf10443f278587cb72900324884908d8441c407,c,c
    ::#,1703,edu,bg-bg,3206626386,2449636070,c6ead57dcc61d87f3c43b78526fdbbe78d912377,f48b253b765dff39881651030268c09392de1555,c,c
    ::#,1703,edu,cs-cz,3207310586,2447727068,031224c662881365f2a971dfe42ea342c9448796,3e56ca36104feac70f46cf7ea0a8853b1b500b3d,d,d
    ::#,1703,edu,da-dk,3226462806,2467425384,60aba504f24ddbb177c94edf837ca85c21662fe0,ef137301727174a08df1fb84743469139bc4e925,d,d
    ::#,1703,edu,de-de,3327083894,2576555370,fad7f186a2e646d16a6a6b56f11b01ee0cc14f1f,d1f9c856dee75466ecd396f027aabaf640fc2122,d,d
    ::#,1703,edu,el-gr,3226390944,2467105860,c51af64f28ae99c28a3f453365195ded29aeeb2e,535d32d74692fba745c4f3241549b949d76e5d68,c,c
    ::#,1703,edu,en-gb,3282224232,2540526024,d2fd393536a0910ce1d69eb94dba465e24a545fe,0673fd68d4acd8c079a35a2213b06b318e05ff07,d,d
    ::#,1703,edu,en-us,3283493420,2541035512,5fcec6f04b988820c7a7c9324e1d8a78e897efd2,6e18fed58e3ca6097828e0b85cb9d71a6e812b47,d,d
    ::#,1703,edu,es-es,3293989448,2546176642,c2cf0c41654a9f36b7788210ccc07b98d353b63a,0d30a4ee2fff7affecb4bdff17eb67e9bc935a7f,d,d
    ::#,1703,edu,es-mx,3255353974,2493052572,9f9d726cd46235d4ec471c8ade9a0144a01512e2,5024e49e1c0ab3b0d7db5405dc1a835c5e82529e,d,d
    ::#,1703,edu,et-ee,3173983282,2429343544,8bc1d88e96a8b5563bc153cc3fd2ec1e558eeb70,20605729c6933a0d6e4dc02a03df3d404c9923ed,c,c
    ::#,1703,edu,fi-fi,3211676114,2443850910,9d0403b9310263edb3fa8e4926c033288d5d77dd,152a5599fdde049965f043ef4cd3594f725177a0,c,c
    ::#,1703,edu,fr-ca,3267937290,2520135272,1afa5bfa09a0bfa82187f93ebeb72327c8babb75,b9eef07b0f4c8d398b452a02e400e2004e1060ee,c,c
    ::#,1703,edu,fr-fr,3280449890,2541782742,c13e3a943e43a78b77954fd490ca9fddd613e36b,6d2c95ab1708554903effed98043384c07009ce1,d,d
    ::#,1703,edu,he-il,3211561870,2457389036,35fcaf72f58e39dfef29d1bc2ef909e18e4e3e8e,ccaa33207aed1be2676b952e216b70c27b0d44bd,d,d
    ::#,1703,edu,hr-hr,3187910322,2432051490,371dc050f05b667eb0ddd07f4628a6e2f6d8bbd8,d47d0ef940827000c610141a20244be8db49e093,d,d
    ::#,1703,edu,hu-hu,3198669702,2443321470,4dff1276e483c996460413fde34f4ddb2d82ec2b,3f21594fcd99429f43a134b2ad705a39a6e93a23,c,c
    ::#,1703,edu,it-it,3252699004,2499266318,1281c83d18b4a3f896b12d503fb8c04e574b579c,2cdf05c94907e814f86875c69a33fdb3f4afa56f,d,d
    ::#,1703,edu,ja-jp,3380955790,2619755766,5d61c365a23b3b1af2e52064b8d9403225f98d38,4c232d7187a7deae3b7a442becf86e83aa92585b,c,c
    ::#,1703,edu,ko-kr,3263151432,2510631222,72ec8182516a922a2790559421e3dd7a12076588,60598d7cb17d96b714e8c1e46331e8477ddfde26,d,d
    ::#,1703,edu,lt-lt,3171495573,2428993596,91811ee67098cfc971e0beca22b204f61638cfab,cdeeab36d55a0697a857988ba3539b5889a0b667,c,c
    ::#,1703,edu,lv-lv,3170436086,2428345960,17663ddefe2473ed47e1ab3021aecb49a2911957,621cb2345a0bb589f11aff848467e52a64b4aa5c,c,c
    ::#,1703,edu,nb-no,3205527402,2445596626,36959196b44da127aea969a96024af7e09de1032,a58a554d48058666f6ed04f656e7679cfeb69532,c,c
    ::#,1703,edu,nl-nl,3209719614,2451085940,4f802d5a36d6d129446419d00faf96c60f574ba3,cb9d8986c2d5d3a5845aac14e311133228184854,d,d
    ::#,1703,edu,pl-pl,3228161764,2472848030,169ea673afe3d895dde85efbee23ddce221f44f6,454e63ac6d99ea6627d7841bc0410875b5ebcc6e,c,c
    ::#,1703,edu,pt-br,3242537098,2503136758,9c8ee58f9ecc4c5748166e10788b7aef771491ad,2425c7a1c1d5f265c67fa7c06b5ce4459b305214,c,c
    ::#,1703,edu,pt-pt,3229372742,2470097536,c02515d94fbd41341f59025a2c89ebf87dabfd29,84fe29af7992ee44492f232c4be3682d03c86ca8,d,d
    ::#,1703,edu,ro-ro,3185051694,2433381486,0407c402d5a3c1c83d4b8a30cfb01747f72385e4,a197a2dae04fb628ef7d26afa7fb916168425a5b,d,d
    ::#,1703,edu,ru-ru,3247965106,2499430086,0a35728822997a3290ced87d63dd0da3f20435fa,71d32106405319b240dcf070f7685b3d1832e77e,d,d
    ::#,1703,edu,sk-sk,3193305246,2433557044,5fd6a7c13e5ad9dd90df492087ec24d814958abc,9cc504744b4aa015b221185332454ef7b16ab7be,c,c
    ::#,1703,edu,sl-si,3180336710,2429463296,dd4fc454cf52c17cc1d3c65cadad865ec39cf331,f8bed0bf249db18ef548358975e522cd5058ce80,d,d
    ::#,1703,edu,sr-rs,3186224050,2430903936,1b5296f5a5974bf00111a4e566ef945c831ad420,cee1f8554f96a20ab6f2cafbf97ec64fc8ab0cb0,d,d
    ::#,1703,edu,sv-se,3201626294,2445395424,95250cfc844f35e2882f32671ae1de8c976c4fe5,bdb42eeac01c6f273523b5acf72eef383a0c74b4,c,c
    ::#,1703,edu,th-th,3201916226,2446891086,ba005f9b74ee05f93746bce839dc877360e28922,8d24243de4efadbae4ad505b7d3ac9a911215675,d,d
    ::#,1703,edu,tr-tr,3204014662,2445522614,257208062c06e87b315007769087170d277d4a69,419b90478352a0ffb34a4acda6ad65b8c3007a44,d,d
    ::#,1703,edu,uk-ua,3206768732,2451238526,b843e99042a296e35f0821816a2ad619a5395c3d,92d482a317102c5c9c0d82c633dc2224a2e9d27a,d,d
    ::#,1703,edu,zh-cn,3448766646,2692947978,2a825c67608ded61192a63bec775096213aa5205,1c5b9c6233824e29683eab03a330597043be909d,c,c
    ::#,1703,edu,zh-tw,3384825764,2620904612,0ac1ba13c4ec709fd6edfacd6584adcefa626aee,6d88e81c026f66d3873622cd852f59b511031388,c,c
    ::#,1703,prN,bg-bg,3062965392,2342230796,5f44e18a89a33ee13c3f58956e2875c4a69e4339,784397435172346058dcddaaf598f50c1106052c,c,c
    ::#,1703,prN,cs-cz,3061390492,2340828822,eab2c98d358e19006bc5501eb376eb78c5f61ff4,f7d6e4300851b880570a4b42c290ea43a51e825a,c,c
    ::#,1703,prN,da-dk,3071035468,2357616126,b16e9860d40df7b56e1dd6ac5c66d3695ca605ac,1705dd7e86d7afcf517c549a94e2db7a445b595f,d,d
    ::#,1703,prN,de-de,3174390478,2468947694,b4f3bf648271229e67c02d4a9c3e928f59671182,3d1516229572cd93b7aa643c5afbd38f6208e9f6,d,d
    ::#,1703,prN,el-gr,3058180776,2358200780,ba6536791a95ddde7eb6d2092fbe4dc256263bc3,d2b7504700e688f39d66a773bae8f0e5ce34f79b,d,d
    ::#,1703,prN,en-gb,3138889370,2427693510,ebf08fbb1b8a857b5ddf615ecdb2e05576fde6fe,4de9f2360f0645a3fadfab850f9ab48762573d78,d,d
    ::#,1703,prN,en-us,3134074578,2431422208,8f08b14b8e4215d95df4aa8f6677c442f3280608,a7497ef7aff694250be967d2d10c6116a5d26523,d,d
    ::#,1703,prN,es-es,3147378694,2440408844,e980e0e4d391747c5079b9bcf8fa02f3610dadf8,a08ff7d5dfe25eb51d56341c4df866577c6e5e65,c,c
    ::#,1703,prN,et-ee,3033156374,2320456032,a5459eab69a630f6de0f5f7ed390d80da6287d1e,0a26ea09337519ba115f21b78e3f0aed0ab45b0d,c,c
    ::#,1703,prN,fi-fi,3058342604,2342355544,b41a9b486513d44ea20c0036973ce7e7e5677d2d,bab89eeb930561e0140eb12be7a06d6df16476bc,d,d
    ::#,1703,prN,fr-fr,3135241050,2432693414,7b1918b7a43b5c484f9604888dfd571eb5ef989c,1fa92c0dd81a6cac8efa741d27d6902f04f5f941,d,d
    ::#,1703,prN,hr-hr,3031238450,2327449750,83872704fe26c66dddb5588c43d0c5105f0a8e7e,0a725ce083bacfcced9022209bef12ab5dfdd58a,c,c
    ::#,1703,prN,hu-hu,3046729422,2342265870,dfe00bed39f3293acedfc60d4703b093b627c1bf,0aa88a593232240db6c89ab9bcd3d994fe047f8e,c,c
    ::#,1703,prN,it-it,3100978042,2385126888,9b988be77d94a9ceecfdd3c0aeb1a2921f3b3ab4,8d67fd32d106b0d7ab3b8375a013f681cbba1dff,c,c
    ::#,1703,prN,lt-lt,3028157126,2326102028,0712851abb0163df81f8692ffab04d6b1b19c7d5,37b27db921300461795edcaae085528735fa28aa,c,c
    ::#,1703,prN,lv-lv,3028725540,2326564272,d1678361ca61445e7e808a67548dc37292ebb2af,fcb378ef59b277223986482e8d0528608f74d4ff,d,d
    ::#,1703,prN,nb-no,3059758392,2338122848,326efdbe48d12dfbf7fb5be385d99ddf9891c464,c485cf3d979b1d3e85f249d39489c9c7ae077720,c,c
    ::#,1703,prN,nl-nl,3058822848,2342693286,834e4a5b1ee8a34ea6d7ab97d1543727ef07f066,9f9538de6a63c6eb9a510c1edf3f8dbf7c885dbf,d,d
    ::#,1703,prN,pl-pl,3078483218,2363883710,f503b82af5c2a1d7d3db92867c7ad8ea8c506e25,44d11c4f07f54617067a5c50a37f23047b260ad1,d,d
    ::#,1703,prN,pt-pt,3076144756,2357325274,105e7656ad4f9472f46a990e9af6fc6008bb0299,53e8e14cfd0703bfd4d529e4a6caac2352d117da,c,c
    ::#,1703,prN,ro-ro,3035255674,2328716638,07129c8b89771ee78d55b28fa0235eb5fbc203a3,672763eea048eabf9d2561532a051eecd3447d93,c,c
    ::#,1703,prN,sk-sk,3038980680,2329998398,96df6aaa8c80e17a364518e4407ec341654b7312,b5764a025eb14227a8d48a23fb53c9af2e0e2032,c,c
    ::#,1703,prN,sl-si,3027672078,2325483758,3e44dc84aef2463ed56352740a0b170651acda74,3de28a415bf6d3424387b91e5e8d54219785fa7f,c,c
    ::#,1703,prN,sv-se,3055257762,2341328688,451e5df2b8a32f7bfd04ed1b20737a16b0a3d770,d226b50b2dd9f995d4080b98030bbabcdafe76d6,c,c
    ::#,1703,pro,ar-sa,3269139960,2494401210,3963c262ac8d2b8054df782a94354ffbd234f52d,9576073ffabf77db7d51f90a37aa2df01f3fabd0,c,c
    ::#,1703,pro,bg-bg,3229523040,2450825844,d9868eb90a2d6a89244a402adfcb3fefc5a2e0e0,dba3940d5ad6dc45140bb6994d20aa527766cea6,c,c
    ::#,1703,pro,cs-cz,3225207160,2450450424,b2c8da4d2f96e81a1dfa20a38e318ef604d27587,50c30eb573ec91cfcca178745775d38f7b986b78,d,d
    ::#,1703,pro,da-dk,3242370264,2468847300,8bf3e4027b0ee612a32bfb0821e9f4424030c71c,c9a3e82cf520a3814454c24c35a4c06919ed1652,d,d
    ::#,1703,pro,de-de,3349142306,2569095198,3f35923a27d57e6b531a926824d68d70ca201e23,4e203ac80f25a6a21727dc915d80074bc5877954,c,c
    ::#,1703,pro,el-gr,3246934952,2468868678,fc990c37e360b0b3242ae7b4989fd3bcc457635b,dd90f8a993016a0847101c8e2eb1b059177860ea,c,c
    ::#,1703,pro,en-gb,3312166688,2540699908,7e7b2b9d0c229a5083fd45a7d17e77bcdabf8e69,b611bd4eb7e100596062445444a90b37d32a1540,d,d
    ::#,1703,pro,en-us,3306899294,2541865106,4ec0294c4ece0c7d977c7de1fac74f5a43412c37,5af2b28a2edeee03d47c17668797c8795cf56d2e,d,d
    ::#,1703,pro,es-es,3318862104,2546579330,d62f6693f86651315289ec6c2a36951e330053a4,7ee3ab0dc272ae71ad9638e64f734bc733e20a51,c,c
    ::#,1703,pro,es-mx,3266281600,2495688050,5732b1f2c9716012a0a5e8262f380a903b857612,ed1de56ac8f100eb7ceed68da3787004434d0c6d,c,c
    ::#,1703,pro,et-ee,3199845540,2429532836,4d4653f610d9ac20bd32aa4860a055c8ee4724d7,c067ab95f0417dfe757f673f48cf77606ced0e99,c,c
    ::#,1703,pro,fi-fi,3224291788,2455923358,a9ce6b78c9dfd83bea9a93f9693dca3db27ea3f0,5145376a20a27f09b990b8442c062f91139f4b59,d,d
    ::#,1703,pro,fr-ca,3288230206,2521110928,48d917594ec3ee11df4ecb89a28d67d5621d34b1,0d84ca5ed316ab3dddc76ecb624bad5c758e5adc,d,d
    ::#,1703,pro,fr-fr,3306810834,2542532614,fcdef8db06ed83cefc4a9764edf9e300c8a834e0,51175bc8447a6bf82b742c2bedb2513ce3c26772,c,c
    ::#,1703,pro,he-il,3232992066,2457645752,352cb000c67fdb818f2b6055354a167d4cd0a69d,35d3f60ebe22ba28fe51522a71d70269944a8789,d,d
    ::#,1703,pro,hr-hr,3211331764,2433167276,f939dc75371ec69876c572d491498aaa4a0bea72,a1c6c6d83e61563a5b094e59f9591d4a48430236,d,d
    ::#,1703,pro,hu-hu,3221998158,2443048982,ab6424a97b162cc189a3ee111f230b9b5decefc0,4d5d740d8b644610fdfc403f09c75e471dc48fa1,d,d
    ::#,1703,pro,it-it,3271830856,2500671908,b14fbaaa8ac55b6036fa2749bdb10d9eddfca97a,cedc39f6ae98c61ac0647b4a067040b1a244c913,d,d
    ::#,1703,pro,ja-jp,3399536718,2623127146,4cc008c93ceb0b76392a1c012c76ee14fcbee660,5f3a233a97b3a824de588902db59175274e7c6fe,c,c
    ::#,1703,pro,ko-kr,3286198386,2511427192,b6399dbba1a2852805086b4581d4b202dabd0d2f,b5908819eca098113bc9ef3f763a1b75aad14b84,c,c
    ::#,1703,pro,lt-lt,3205686580,2429889618,8a7beb73b01dd32141ad119a09a8bc01ebec01da,09c68f4e38d2b94671012239cf29867671999271,c,c
    ::#,1703,pro,lv-lv,3203530768,2428535640,26425a6a8d0f6aa9a05782977b692e190f7b3fe1,71d5489b02a14a1ff7eca965ceb9833f19627447,d,d
    ::#,1703,pro,nb-no,3227302824,2441045070,cf80da8119dff6edd83fc14d04f1c07a93154522,070a95e2239444b095e94bb42d1d9da70f13283b,d,d
    ::#,1703,pro,nl-nl,3231406962,2453422694,dbce7a99d33758f6880e3e25869f4dcf8cba168f,0149b5bcb08496f561e962adf8bf4bb4eb74dae7,c,c
    ::#,1703,pro,pl-pl,3254396898,2475957478,711e0bd9cba640f046d24c965478dc4c64b6bb56,07c08c77c8932aff2cd74aa51f25767200fb2d05,d,d
    ::#,1703,pro,pt-br,3271791946,2503293424,6a1729c45317670a371ab95a2888c8d46c246efd,b57a3631b25084d4608c1297d80d6aaae245bc1b,c,c
    ::#,1703,pro,pt-pt,3242820652,2473189542,543d6cf7ba085eb01fe476589b3f853f68e14a1f,04c8f1dbe58217d0e9ec83570dc205002d2fbf62,d,d
    ::#,1703,pro,ro-ro,3212920292,2433641874,7043ae390b72561e8575213280c65932fcd57bf8,6f3b6a6d0129fc638f0183fa02e9c06a46efbf69,d,d
    ::#,1703,pro,ru-ru,3277964848,2499856318,5c82a5b3d47e369e08950d1bf990d66af71382ee,b7ce8535a9d98b725decd942e0d3be30754a0575,c,c
    ::#,1703,pro,sk-sk,3209614406,2434620244,2be1c1c86924229c575ea86256ea6ceafa9250c5,1a19d541a7d730b039e8df7dd7398bfcf4830291,d,d
    ::#,1703,pro,sl-si,3193801558,2429892232,a76a6a9aba283de1d5a2c13e25f2d6f46b7b7328,0e50d975b2fe90a58aecc3c7cc201457f435c025,c,c
    ::#,1703,pro,sr-rs,3205347802,2432319216,35e53089ec427c155f267988176a98a9ba6729c1,00596ed8b28cfdc923415ce6331866b81d91033f,c,c
    ::#,1703,pro,sv-se,3238580990,2445959076,73a9dc803eadeb9026e7e431cb244af6bfe7c0b4,74da5ba69fe1e6910f3cc9a085a794f12e22ef58,d,d
    ::#,1703,pro,th-th,3233561098,2450007156,edc54e4750f7716be213f9b18e65b4eb492be1f0,67f63c4d073486cd33353f450883d921dde35945,d,d
    ::#,1703,pro,tr-tr,3218876806,2448261418,f800b571c0045b463801a504a7025816ff741d6c,b6a86891756286e3ba6b1ebd4d47e59c0c1cf5c1,d,d
    ::#,1703,pro,uk-ua,3230917596,2453351344,867689f02d837ec57b73cd705ad7bf8c70c7ddd5,4f4683215f0b795a943992677e989e4977016227,c,c
    ::#,1703,pro,zh-cn,3462073854,2693248436,63be8d0a2fb3ede0f5336ab238c871a10a2a3515,a09759e7eba5eb47e1714ef9fb90fbb9b8b16926,c,c
    ::#,1703,pro,zh-tw,3405611514,2622868522,450f612a2ef4eb388806e0e71456a45f3ff86702,b04b61789de4357e5b558e3304d251be84717905,c,c
  16. AveYo revised this gist Mar 20, 2021. 2 changed files with 30 additions and 5 deletions.
    26 changes: 24 additions & 2 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,27 @@
    ![Preview1](https://i.imgur.com/dHYAHiT.png)
    ![Preview2](https://i.imgur.com/EEQbC2k.png)
    ![Preview1](https://i.imgur.com/EEQbC2k.png)

    >Hello! I bring news. Beside the introduction of **21H1 MCT** ;)
    ![Preview2](https://i.imgur.com/dHYAHiT.png)

    >**First, I have added create media preset(s) that when used, will send you right at the select usb or save iso dialog.**
    >And when booting from the media, the pick edition dialog will be skipped.
    >The attempts I've seen in this thread were mostly failing because /Pkey option is only meant for retail bought keys, not for generic / hwid!
    >To overcome this limitation script simply generates a `PID.txt` with the key you provide and then adds it to the media `sources` folder.
    >**Second, I have reworked the auto upgrade preset (actually more like reverted it to how it was intended initially)**.
    >The notable change is that the script now has to take the initiative and ask for admin rights itself.
    >That's so it can wait in the background for MCT to finish the first phase of creating upgrade media.
    >Once that's done, it will launch setupprep for the second phase (via auto.cmd) and then quit.
    >This allows a seamless upgrade experience with no intermediary prompts.
    >As a bonus, you can set lang, edition, arch, key to upgrade to a different edition than the current one!
    >_I have done plenty of such upgrades today going forward and backward from/to 20H1/20H2/21H1 switching edition several times - since all have the same 19041 base, means you get full upgrade with files, apps and settings saved (if lang and arch are compatible)._
    >Try it out just by renaming the script to `auto MediaCreationTool.bat` - by default starts upgrade to 21H1
    >Can also add the numeric version target: `auto 2004 MediaCreationTool.bat` or `auto 2009 MediaCreationTool.bat`
    >**For those that use the script _as-is_, these enhancements do not affect the workflow in any way.**
    >Script will simply pass control to MCT and quit early as before.
    ```
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
    9 changes: 6 additions & 3 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -53,8 +53,10 @@ if defined ARCH set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaArch %ARCH%
    :: parse options to auto upgrade with less issues and prompts
    for %%a in (%~n0) do if /i %%a EQU auto set/a AUTO=1
    if defined AUTO if not defined VER set/a VER=12
    if defined AUTO set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade
    if defined MEDIA if not defined AUTO set OPTIONS=%OPTIONS% /Eula Accept /Action CreateMedia

    :: supress EULA prompt for auto upgrade or create media presets
    if defined MEDIA set OPTIONS=%OPTIONS% /Eula Accept
    if defined AUTO if not defined MEDIA set OPTIONS=%OPTIONS% /Eula Accept

    :: choices dialog
    if not defined VER call :choices VER "%CHOICES%" 12 "Create Windows 10 Media" 11 white dodgerblue 300
    @@ -311,11 +313,12 @@ timeout 5 >nul
    if not defined AUTO if not defined PID if not exist ..\$OEM$\* start MediaCreationTool%V%.exe %OPTIONS% &exit/b

    :: generate auto.cmd for auto upgrade custom preset with less issues
    if defined AUTO set OPTIONS=%OPTIONS% /MigChoice Upgrade /Auto Upgrade
    >auto.cmd echo @set OPTIONS=%OPTIONS% /Action UpgradeNow
    >>auto.cmd echo @if exist "%%~dp0sources\setupprep.exe" start "w" "%%~dp0sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    >>auto.cmd echo @if exist "%%~dp0x64\sources\setupprep.exe" start "w" "%%~dp0x64\sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    >>auto.cmd echo @if exist "%%~dp0x86\sources\setupprep.exe" start "w" "%%~dp0x86\sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    if defined AUTO set OPTIONS=%OPTIONS% /Action CreateUpgradeMedia
    if defined AUTO (set OPTIONS=%OPTIONS% /Action CreateUpgradeMedia) else if defined MEDIA set OPTIONS=%OPTIONS% /Action CreateMedia

    :: generate PID.txt if PID was supplied to select a specific edition with less prompts
    if not defined PID (del /f /q PID.txt 2>nul) else echo [PID]>PID.txt & for %%s in (%PID%) do echo Value=%%s >>PID.txt
  17. AveYo revised this gist Mar 20, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ![Preview1](https://i.imgur.com/EEQbC2k.png)
    ![Preview2](https://i.imgur.com/wSd1DlZ.png)
    ![Preview1](https://i.imgur.com/dHYAHiT.png)
    ![Preview2](https://i.imgur.com/EEQbC2k.png)

    ```
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
  18. AveYo revised this gist Mar 20, 2021. 2 changed files with 189 additions and 73 deletions.
    3 changes: 2 additions & 1 deletion .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -21,5 +21,6 @@
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    ```
    259 changes: 187 additions & 72 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -1,105 +1,127 @@
    @call :init MediaCreationTool.bat - latest version at pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 21H1!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.12.11
    :: - updated 20H2; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    :: - fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    :: - generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    :: - 2009: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112
    :: Changelog: 2021.03.20
    :: - pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
    :: - 2104: 19043.867 / 2009: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2]
    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2], 2104 [21H1]

    :: comment to not unhide Enterprise for 1709+ in products.xml
    set/a UNHIDE_BUSINESS=1

    :: comment to not insert Enterprise esd links for 1511,1607,1703 and update links for 1909,2004 in products.xml
    :: comment to not insert Enterprise esd links for 1607,1703 or update links for 1909,2004,2104 in products.xml
    set/a UPDATE_BUSINESS=1

    :: uncomment to bypass gui dialog choice and hardcode the MCT version: 1=1507, 2=1511, 3=1607, ... 10=20H1, 11=20H2
    rem set/a MCT_VERSION=11
    :: uncomment to bypass gui dialog choice and hardcode the MCT version: 1=1507, 2=1511, .. 10=20H1, 11=20H2, 12=21H1
    rem set/a VER=12

    :: uncomment to force a specific Edition, Architecture and Language - if enabled, all 3 should be used
    rem set OPTIONS=%OPTIONS% /MediaEdition Enterprise /MediaArch x64 /MediaLangCode en-us
    :: uncomment to start auto upgrade preset without prompts - or just rename the script to "auto MediaCreationTool.bat"
    rem set/a AUTO=1

    :: uncomment to force Auto Upgrade without user intervention - or just rename the script to "auto MediaCreationTool.bat"
    rem set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow
    :: uncomment one to preset MediaLangCode, MediaEdition, MediaArch and generic PID.txt - need all to skip the pick screen
    rem set LANGCODE=en-us & set EDITION=Core & set ARCH=x64 &set PID=YTMG3-N6DKC-DKB77-7M9GH-8HVX7
    rem set LANGCODE=en-us & set EDITION=Professional & set ARCH=x64 &set PID=VK7JG-NPHTM-C97JM-9MPGT-3V66T
    rem set LANGCODE=en-us & set EDITION=Education & set ARCH=x64 &set PID=YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY
    rem set LANGCODE=en-us & set EDITION=Enterprise & set ARCH=x64 &set PID=NPPR9-FWDCX-D2C8J-H872K-2YT43

    :: uncomment to disable dynamic update when doing upgrades - it increases the duration substantially
    rem set OPTIONS=%OPTIONS% /DynamicUpdate Disable
    :: comment to not postpone key entering if needed - note that /Pkey value should not be a generic key like the above
    set OPTIONS=%OPTIONS% /Pkey Defer

    :: add / remove extra launch parameters below if needed - default preset gives the least amount of issues when doing upgrades
    set OPTIONS=%OPTIONS% /MigrateDrivers All /ResizeRecoveryPartition Disable /ShowOOBE None /Compat IgnoreWarning /CompactOS Disable
    :: comment to allow dynamic update - it increases the duration and failure rate when doing upgrades
    set OPTIONS=%OPTIONS% /DynamicUpdate Disable

    :: comment to enable default setup telemetry
    :: comment to allow default setup telemetry
    set OPTIONS=%OPTIONS% /Telemetry Disable

    :: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
    :: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    for %%V in (1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009) do if %%~xV==.%1 set MCT_VERSION=%%~nV
    :: add / remove setup options below if needed - default preset gives the least amount of issues when doing upgrades
    set OPTIONS=%OPTIONS% /Compat IgnoreWarning /CompactOS Disable /MigrateDrivers All /ResizeRecoveryPartition Disable /ShowOOBE None

    :: handle auto upgrade scenario without user intervention when script was renamed to "auto MediaCreationTool.bat"
    for /f %%s in ("%~n0") do if /i %%s EQU auto if not defined MCT_VERSION set MCT_VERSION=11
    :begin

    :: parse first commandline parameter as version: MediaCreationTool 1909 - can also rename script to "1909 MediaCreationTool.bat"
    set enum=1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009 12.2104
    for %%V in (%enum%) do if %%~xV==.%1 (set/a VER=%%~nV) else for %%N in (%~n0) do if %%~xV==.%%N set/a VER=%%~nV

    :: parse options to create media with less prompts - also works in auto upgrade preset to switch target edition
    (for %%s in (%LANGCODE%) do set LANGCODE=%%s) & (for %%s in (%EDITION%) do set EDITION=%%s) & (for %%s in (%ARCH%) do set ARCH=%%s)
    if defined LANGCODE set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaLangCode %LANGCODE%
    if defined EDITION set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaEdition %EDITION%
    if defined ARCH set MEDIA=1 & set OPTIONS=%OPTIONS% /MediaArch %ARCH%

    :: parse options to auto upgrade with less issues and prompts
    for %%a in (%~n0) do if /i %%a EQU auto set/a AUTO=1
    if defined AUTO if not defined VER set/a VER=12
    if defined AUTO set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade
    if defined MEDIA if not defined AUTO set OPTIONS=%OPTIONS% /Eula Accept /Action CreateMedia

    :: choices dialog
    if not defined MCT_VERSION call :choices MCT_VERSION "%CHOICES%" 11 "Create Windows 10 Media" 12 white dodgerblue 300
    @goto version-%MCT_VERSION%
    if not defined VER call :choices VER "%CHOICES%" 12 "Create Windows 10 Media" 11 white dodgerblue 300
    @goto choice-%VER%

    :version-0
    %<%:e1 " NO MCT_VERSION SELECTED "%>% & popd & timeout /t 5 >nul & exit/b
    :choice-0
    %<%:e1 " NO VER SELECTED "%>% & popd & timeout /t 5 >nul & exit/b

    :choice-12
    set "V=2104" & set "B=19043.867.210305-1751.21h1_release_svc_refresh" & set "D=2021/03/" & set "C=1.4.1"
    set "CAB=http://download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=http://download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    :: refreshed 19041 base with integrated 21H1 enablement package - pre-release, generated
    goto process

    :version-11
    :choice-11
    set "V=2009" & set "B=19042.631.201119-0144.20h2_release_svc_refresh" & set "D=2020/11/" & set "C=1.4.1"
    set "CAB=http://download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=http://download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    :: just a 2004 with an integrated enablement package to mainly bundle ChrEdge and bloat install.esd
    :: refreshed 19041 base with integrated 20H2 enablement package to mainly bundle ChrEdge
    goto process

    :version-10
    :choice-10
    set "V=2004" & set "B=19041.508.200907-0256.vb_release_svc_refresh" & set "D=2020/09/" & set "C=1.4"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=19041.572.201009-1946.vb_release_svc_refresh" & set "D=2020/11/"
    set "CAB=http://download.microsoft.com/download/7/4/4/744ccd60-3203-4eea-bfa2-4d04e18a1552/products.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/8d71966f-05fd-4d64-900b-f49135257fa5/MediaCreationTool2004.exe"
    :: visible improvements to windows update, defender, search, dx12, wsl, sandbox; pushing ChrEdge update intensifies
    :: visible improvements to windows update, defender, search, dx12, wsl, sandbox
    goto process

    :version-9
    :choice-9
    set "V=1909" & set "B=18363.592.200109-2016.19h2_release_svc_refresh" & set "D=2020/01/" & set "C=1.3"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=18363.1139.201008-0514.19h2_release_svc_refresh" & set "D=2020/11/"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    :: just a 1903 with an integrated enablement package to activate usability and security fixes
    :: refreshed 18362 base with integrated 19H2 enablement package to activate usability and security fixes
    goto process

    :version-8
    :choice-8
    set "V=1903" & set "B=18362.356.190909-1636.19h1_release_svc_refresh" & set "D=2019/09/" & set "C=1.3"
    set "CAB=http://download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=http://download.microsoft.com/download/9/8/8/9886d5ac-8d7c-4570-a3af-e887ce89cf65/MediaCreationTool1903.exe"
    :: modern windows 10 starts here with proper memory allocation, cpu scheduling, security features
    goto process

    :version-7
    :choice-7
    set "V=1809" & set "B=17763.379.190312-0539.rs5_release_svc_refresh" & set "D=2019/03/" & set "C=1.3"
    set "CAB=http://download.microsoft.com/download/8/E/8/8E852CBF-0BCC-454E-BDF5-60443569617C/products_20190314.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    :: rather mediocre considering it is the base for ltsc 2019; less smooth than 1803 in games; intel pre-4th-gen still buggy
    goto process

    :version-6
    :choice-6
    set "V=1803" & set "B=17134.112.180619-1212.rs4_release_svc_refresh" & set "D=2018/07/" & set "C=1.2"
    set "CAB=http://download.microsoft.com/download/5/C/B/5CB83D2A-2D7E-4129-9AFE-353F8459AA8B/products_20180705.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    :: update available to finally fix most standby memory issues that were present since 1703; intel pre-4th-gen still buggy
    goto process

    :version-5
    :choice-5
    set "V=1709" & set "B=16299.125.171213-1220.rs3_release_svc_refresh" & set "D=2018/01/" & set "C=1.1"
    set "CAB=http://download.microsoft.com/download/3/2/3/323D0F94-95D2-47DE-BB83-1D4AC3331190/products_20180105.cab"
    set "MCT=http://download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    :: plagued by standby and other memory allocation bugs, fullscreen optimisation issues, worst version of windows 10 by far
    goto process

    :version-4
    :choice-4
    set "V=1703" & set "B=15063.0.170317-1834.rs2_release" & set "D=2017/03/" & set "C=1.0"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=15063.0.170710-1358.rs2_release_svc_refresh" & set "D=2017/07/"
    rem set "XML=http://download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    @@ -109,14 +131,14 @@ set "MCT=http://download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35
    :: some gamers still find it the best despite unfixed memory allocation bugs and exposed cpu flaws; can select Cloud (S)
    goto process

    :version-3
    :choice-3
    set "V=1607" & set "B=14393.0.161119-1705.rs1_refresh" & set "D=2017/01/" & set "C=1.0"
    set "CAB=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products_20170116.cab"
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: snappy and stable for legacy hardware
    goto process

    :version-2
    :choice-2
    set "V=1511" & set "B=10586.0.160426-1409.th2_refresh" & set "D=2016/05/" & set "C=1.0"
    set "XML=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products05242016.xml"
    set "MCT=http://download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    @@ -125,7 +147,7 @@ set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68
    :: most would rather go with 1507 or 1607 instead as with a little effort can apply latest ltsb updates on all editions
    goto process

    :version-1
    :choice-1
    set "V=1507" & set "B=10240.16393.150909-1450.th1_refresh" & set "D=2015/09/" & set "C=1.0"
    set "XML=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products09232015_2.xml"
    set "MCT=http://download.microsoft.com/download/1/C/8/1C8BAF5C-9B7E-44FB-A90A-F58590B5DF7B/v2.0/MediaCreationToolx64.exe"
    @@ -139,7 +161,7 @@ goto process
    :init script
    @echo off & title %1 & color 1f & mode 120,30
    :: self-echo top 2-20 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,20) do set \=& set/p \=& call echo;%%\%%)
    <"%~f0" (set/p \=&for /l %%/ in (1,1,21) do set \=& set/p \=& call echo;%%\%%)
    :: lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    for /f "delims=:" %%\ in ('echo;prompt $h$s$h:^|cmd/d') do set "|=%%\" &set ">>=\..\c nul &set/p \=%%\%%\%%\%%\%%\%%\%%\<nul&popd"
    set "<=pushd "%allusersprofile%"&2>nul findstr /c:\ /a" &set ">=%>>%&echo;" &set "|=%|:~0,1%" &set/p \=\<nul>"%allusersprofile%\c"
    @@ -148,7 +170,7 @@ for %%s in (latest_MCT_script.url) do if not exist %%s (echo;[InternetShortcut]&
    :: use MCT workfolder
    pushd "%~dp0" & mkdir MCT >nul 2>nul & pushd MCT
    :: (un)define main variables
    set "UPDATE=" & set "XML=" & set "CAB=" & set "MCT_VERSION=" & set "OPTIONS=/Selfhost"
    set ARCH=& set LANGCODE=& set EDITION=& set PID=& set MEDIA=& set AUTO=& set VER=& set XML=& set CAB=& set OPTIONS=/Selfhost
    exit/b

    :choices dialog: 1=variable 2="c,h,o,i,c,e,s" 3=selected-index [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=winsize
    @@ -164,14 +186,13 @@ function Choices ($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc=
    if ($global:rez -ne $ch.length) {exit $global:rez} else {exit 0} } :PS_CHOICES: gui choices returning index - snippet by AveYo

    :process selected
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %V% "%>>% & %<%:f1 " %B% "%>>% & %<%:11 ~%>% & echo;
    :: remove unsupported options in older versions
    if %V% LSS 1703 echo %OPTIONS% | findstr /c:"/DiagnosticPrompt enable" >nul && set "OPTIONS=%OPTIONS:/DiagnosticPrompt enable=%"
    if %V% LSS 1709 echo %OPTIONS% | findstr /c:"/Console" >nul && set "OPTIONS=%OPTIONS:/Console=%"
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %V% "%>>% & %<%:f1 " %B% "%>>%
    if defined MEDIA %<%:8f " %LANGCODE% "%>>% & %<%:3f " %EDITION% "%>>% & %<%:5f " %ARCH% "%>>%
    %<%:11 ~%>% & echo;
    :: cleanup workfolder
    (del /f /q products.* & rd /s/q %systemdrive%\$Windows.~WS %systemdrive%\$WINDOWS.~BT) 2>nul
    set latest=0 & if exist latest set/p latest=<latest
    if %latest% LSS 20201211 del /f /q products*.* MediaCreationTool*.exe 2>nul & echo,20201211>latest
    echo,20210319>latest & if %latest% LSS 20201211 del /f /q products*.* MediaCreationTool*.exe 2>nul

    :: download MCT and CAB / XML
    set "DOWN=function dl($u,$f){$w=new-object System.Net.WebClient; $w.Headers.Add('user-agent','ipad'); try{$w.DownloadFile($u,$f)}"
    @@ -188,14 +209,15 @@ if defined CAB if not exist products%V%.cab powershell -nop -c "%DOWN% %LOAD% $e
    if defined CAB if not exist products%V%.cab %<%:1e " products%V%.cab download failed "%>%
    if exist products%V%.cab del /f /q products%V%.xml 2>nul
    if exist products%V%.cab expand.exe -R products%V%.cab -F:* . >nul 2>nul
    set success=1 &for %%s in (products.xml MediaCreationTool%V%.exe) do if not exist %%s set "success="
    echo; & if defined success ( %<%:0f " MCT starts after configuring products.xml, please wait..."%>% ) else (
    %<%:4f " ERROR "%>>% & %<%:0f " Check urls in browser | del MCT dir | unblock powershell | enable BITS serv "%>% &pause &exit/b )
    echo; & set "err=" & for %%s in (products.xml MediaCreationTool%V%.exe) do if not exist %%s set err=1
    if defined err %<%:4f " ERROR "%>>% & %<%:0f " Check urls in browser | del MCT dir | unblock powershell | enable BITS serv "%>%
    if defined err del /f /q products%V%.* MediaCreationTool%V%.exe 2>nul &pause &exit/b
    if not defined err %<%:0f " MCT starts after configuring products.xml, please wait..."%>%

    :: configure products.xml - editing in one go
    set "0=%~f0" & powershell -nop -c $f0=[io.file]::ReadAllText($env:0);iex(($f0-split':PRODUCTS_XML\:.*')[1]) & goto :PRODUCTS_XML:
    [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",[Text.Encoding]::UTF8)
    $ver = $env:V; if ($ver -eq 2009) {$vers = "20H2"} else {$vers = $ver}
    $ver = $env:V; if ($ver -eq 2009) {$vers = "20H2"} elseif ($ver -eq 2104) {$vers = "21H1"} else {$vers = $ver}

    ## apply/insert Catalog version attribute for MCT compatibility
    if ($null -ne $xml.MCT) {
    @@ -233,14 +255,14 @@ if ($env:UNHIDE_BUSINESS -ge 1) {
    if ($ver -gt 1511) {$CONSUMER = 'Home | Pro | Edu'} else {$CONSUMER = 'Home | Pro'}
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64') {continue} ; $edi = $f.Edition; $loc = $f.Edition_Loc
    if ($edi -eq 'Enterprise') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = "$vers Enterprise | Pro | Edu vl"}
    if ($edi -eq 'Enterprise') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = "$vers Enterprise | Pro vl | Edu vl"}
    if ($ver -le 1511 -and ($edi -eq 'Education' -or $edi -eq 'EducationN')) {$f.IsRetailOnly = 'False'}
    }
    }

    ## insert individual business editions in xml that never included them: 1607, 1703
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://fg.ds.b1.download.windowsupdate.com/'
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,1511 -contains $ver) {
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2104,2004,1909,1703,1607,1511 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';pro='Professional';prN='ProfessionalN';edu='Education';edN='EducationN';
    clo='Cloud';clN='CloudN'}
    @@ -263,7 +285,7 @@ if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,15
    }
    }
    }
    ## update existing entries for 1909, 2004
    ## update existing entries for 1909, 2004; add pre-release 2104 entries
    if ($ver -gt 1703) {
    $items = $csv |group Client,Lang -AsHashTable -AsString
    foreach ($f in $root.Files.File) {
    @@ -282,23 +304,40 @@ $xml.Save("$pwd\products.xml")
    :: repack XML into CAB
    makecab products.xml products.cab >nul

    :: handle auto upgrade scenario without user intervention when script was renamed to "auto MediaCreationTool.bat"
    set AUTO_OPTIONS=/Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow
    for /f %%s in ("%~n0") do if /i %%s NEQ auto (set AUTO=) else set AUTO=1
    if defined AUTO echo %OPTIONS% | findstr /c:"Upgrade" >nul && set "OPTIONS=%OPTIONS% %AUTO_OPTIONS%"

    :: [Dev] if present, import a $OEM$ folder into generated media - for example a $OEM$\$$\Setup\Scripts\setupcomplete.cmd
    set "\=<# this optional feature requires script to be [Run as administrator] #> $null=fltmc; if($LASTEXITCODE -gt 0) {return}"
    set "\=%\%; $f='Name=''MediaCreationTool%V%.exe'''; if (($null -eq $MCT) -or -not (Test-Path '..\$OEM$')) {return}"
    set "\=%\%; $sources=$env:SystemDrive+'\$Windows.~WS\Sources\Windows\sources\'; $setup=$sources+'setupprep.exe'"
    set "\=%\%; for (;;) {sleep 20; if(Test-Path $setup){break} ; if((gwmi -Class Win32_Process -Filter $f).ProcessId -le 0){break}}"
    set "\=%\%; if (Test-Path $setup) {xcopy /CYBERHIQ '..\$OEM$' ([char]34 + $sources + '$OEM$' + [char]34)} ; exit 0"

    :: add a short delay to see the script output since the xml processing is too fast :D
    timeout 3 >nul

    :: finally launch MCT executable with local configuration and optional launch parameters
    powershell -win 1 -nop -c "$MCT=start MediaCreationTool%V%.exe -args $env:OPTIONS -passthru; %\%" 2>nul
    timeout 5 >nul

    :: launch MCT executable with OPTIONS and close script if there is nothing to import into sources folder
    if not defined AUTO if not defined PID if not exist ..\$OEM$\* start MediaCreationTool%V%.exe %OPTIONS% &exit/b

    :: generate auto.cmd for auto upgrade custom preset with less issues
    >auto.cmd echo @set OPTIONS=%OPTIONS% /Action UpgradeNow
    >>auto.cmd echo @if exist "%%~dp0sources\setupprep.exe" start "w" "%%~dp0sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    >>auto.cmd echo @if exist "%%~dp0x64\sources\setupprep.exe" start "w" "%%~dp0x64\sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    >>auto.cmd echo @if exist "%%~dp0x86\sources\setupprep.exe" start "w" "%%~dp0x86\sources\setupprep.exe" %%OPTIONS%% ^&exit/b
    if defined AUTO set OPTIONS=%OPTIONS% /Action CreateUpgradeMedia

    :: generate PID.txt if PID was supplied to select a specific edition with less prompts
    if not defined PID (del /f /q PID.txt 2>nul) else echo [PID]>PID.txt & for %%s in (%PID%) do echo Value=%%s >>PID.txt

    :: hint: if you want setup to run a tweaking script before first logon, save it at $OEM$\$$\Setup\Scripts\setupcomplete.cmd

    :: launch MCT executable with OPTIONS and wait it to create sources folder, then import auto.cmd and/or PID.txt and/or $OEM$
    if defined AUTO (set "ROOT=C:\ESD\Windows") else set "ROOT=%SystemDrive%\$Windows.~WS\Sources\Windows"
    set "SRC=%ROOT%\sources" & set "SRC64=%ROOT%\x64\sources" & set "SRC86=%ROOT%\x86\sources"
    set _=cd -Lit('%~dp0MCT'); $MCT=start MediaCreationTool%V%.exe -args '%OPTIONS%' -passthru; if ($null -eq $MCT) {return}
    set _=%_%; ri '%SRC64%\setupprep.exe' -Force -ea 0; ri '%SRC%\setupprep.exe' -Force -ea 0; for (;;) { sleep 20;
    if not defined AUTO set _=%_%; if(Test-Path '%SRC64%\setupprep.exe') {break} if(Test-Path '%SRC%\setupprep.exe') {break}
    set _=%_%; if((gwmi -Class Win32_Process -Filter 'Name=''MediaCreationTool%V%.exe''').ProcessId -le 0) {break} }
    set _=%_%; if((Test-Path 'auto.cmd') -and (Test-Path '%ROOT%\setup.exe')) {copy -Path 'auto.cmd' -Dest '%ROOT%' -Force}
    set _=%_%; if((Test-Path 'PID.txt') -and (Test-Path '%SRC%\setupprep.exe')) {copy -Path 'PID.txt' -Dest '%SRC%' -Force}
    set _=%_%; if((Test-Path 'PID.txt') -and (Test-Path '%SRC64%\setupprep.exe')) {copy -Path 'PID.txt' -Dest '%SRC64%' -Force}
    set _=%_%; if((Test-Path 'PID.txt') -and (Test-Path '%SRC86%\setupprep.exe')) {copy -Path 'PID.txt' -Dest '%SRC86%' -Force}
    set _=%_%; if((Test-Path '..\$OEM$') -and (Test-Path '%SRC%\setupprep.exe')) {xcopy /CYBERHIQ '..\$OEM$' '%SRC%\$OEM$'}
    set _=%_%; if((Test-Path '..\$OEM$') -and (Test-Path '%SRC64%\setupprep.exe')) {xcopy /CYBERHIQ '..\$OEM$' '%SRC64%\$OEM$'}
    set _=%_%; if((Test-Path '..\$OEM$') -and (Test-Path '%SRC86%\setupprep.exe')) {xcopy /CYBERHIQ '..\$OEM$' '%SRC86%\$OEM$'}
    if defined AUTO set _=%_%; if(Test-Path '%ROOT%\auto.cmd') {start '%ROOT%\auto.cmd'}
    powershell -nop -c "start powershell -args ('-nop -win 1 -c',$env:_) -verb runas;" 2>nul &exit/b

    exit || DONE! AveYo: can skip some or all entries below if not interested in updating the esd links in products.xml

    @@ -307,6 +346,82 @@ exit || DONE! AveYo: can skip some or all entries below if not interested in upd
    :: I have chosen to generate them on-the-fly here instead of linking to third-party hosted pre-edited products.xml
    :: [Dev] ESD name has all except size; can get it with (Invoke-WebRequest -Uri $url -Method Head).Headers['Content-Length']
    :PS_UPDATE_BUSINESS_CSV:_,Ver,Client,Lang,Size_x64,Size_x86,Sha1_x64,Sha1_x86,Dir_x64,Dir_x86
    ::#,2104,ret,ar-sa,3424078046,2433096242,5ec896e8eee82f142748536776df0ce6e01e5857,6526fdfcc023131e2de14f67064410b5938e57e6,c,c
    ::#,2104,ret,bg-bg,3487532575,2456193792,907a21b2b44f85c54ca50336b76357e31911564b,7e7ed3758311ff6aced8a46f0106beb182e6e291,c,c
    ::#,2104,ret,cs-cz,3488305302,2449171705,5909dcf04964f65bb078cc2db031d5f640ac4f9d,40b1495eb91b3f8324fffbe226fbfcf1dc74bff9,c,c
    ::#,2104,ret,da-dk,3513665998,2466404822,18c52df9b86f2146c26bf8efb0df6590c59d45db,8988c87052a3a85b166a206b6da92f52b134ed5c,c,c
    ::#,2104,ret,de-de,3614791102,2578093933,cdfe971c77e508f2c28b5f9d32b4c40adb8c98ed,e0569309c49af9d9d18f60332d29fa01fab3c493,c,c
    ::#,2104,ret,el-gr,3513427738,2463424291,4bba7f208f9fe0b4197aee0b9b41d2c09d6b2dfa,7173c9e501e606be2b93f4562a9a03ee3438013e,c,c
    ::#,2104,ret,en-gb,3603517726,2556301582,d127f6ed241856b254d0ec360e0feddb18f8752a,803c8a6a437c9fa7dc5e0a08f2d5b146b8ba9c92,c,c
    ::#,2104,ret,en-us,3609537425,2560527998,99504319cefaeea632b64d7ed470e5ace5f28c31,b9b7ffff22c9827ffb55438a36d81e5008509168,c,c
    ::#,2104,ret,es-es,3610986336,2565178142,f1cfd8cfa59f057d334a7dd099daaf6b4e8676fe,b74f2188d9a347109d10b9beecdcc2d70ee0b4e5,c,c
    ::#,2104,ret,es-mx,3431104232,2431312383,2fa44e4e639f2b2f21ea0b1e813f149f5e95576d,34bd3011be7bd95a1ec7e883bb1e342a32c7a17e,c,c
    ::#,2104,ret,et-ee,3461144959,2421858633,d917f2a5d1588744023a18c7283f4aa1f5cd0c7b,bef818b4f4f32b2e01840590e8984b261c5343a5,c,c
    ::#,2104,ret,fi-fi,3490501870,2451852010,1228c8819a46073efcf21fddd6c62cfc54992f92,22a2d65c43e9ff7be9ba4fb45dd5edd4a200b687,c,c
    ::#,2104,ret,fr-ca,3426408934,2451370923,dcb81dc88c88cc095f3bef56cd8c13e0e5b72453,6cbb62bcd5cfdeadca75f7818fdfab26c39486c8,c,c
    ::#,2104,ret,fr-fr,3617796144,2561100086,1324d70a58a812b8daa07657b0724a7b65edf375,e5b71d7a5348baa5c31fe4e350909f42c0d860a4,c,c
    ::#,2104,ret,he-il,3379313814,2406041191,8b8e6c567136c0e9024ebeae2a572b9b9e2e4d90,22fb58596f497dbc0cde082c85483cf785724a6a,c,c
    ::#,2104,ret,hr-hr,3467680310,2432217514,0d5eeb7157cf9b1689d87255b0a349e2ee80faa0,a1e3d46df3c5d35c06d7cff6f41459cf3073c01d,c,c
    ::#,2104,ret,hu-hu,3476231516,2446944873,9b0ea894c56c99551e88d214d588af4362607bf8,fd6282b736849ac806932f417622a0f8ed764b1c,c,c
    ::#,2104,ret,it-it,3541259073,2493263707,5aefec0a3dfa7d764831077ebd18f8ec287f8acc,c609d141e8cd907672eb3603e16ccc9fa63b87a5,c,c
    ::#,2104,ret,ja-jp,3571126233,2589573586,12fe54fe35f78d372fce5eda31eb2095b242bc4a,baf6f90f85a83b9a37ad94cebbdaad54f39815a0,c,c
    ::#,2104,ret,ko-kr,3403791834,2418929208,8c1c364828a7835a9f3a3866bfbab795489e2268,e4bb9d37eea8c3f84f7cf4be109381e8af9ef57f,c,c
    ::#,2104,ret,lt-lt,3468228613,2424578912,a08470924085c950f7480c44489fc119fefbee34,df1ffa63c4fa4d0982841f0a6b113d246c81ab5f,c,c
    ::#,2104,ret,lv-lv,3466144306,2424101046,0d40955247a9a7711eae7231e3086a20483f2522,e2a6e4804dca68a1f3d9657c5e108e61c8ac7610,c,c
    ::#,2104,ret,nb-no,3478542750,2446777718,fbda90a18752db53e365995de3fe0b795b82a1b0,e5769e752f489843f480e13c05aae1a5cfb45849,c,d
    ::#,2104,ret,nl-nl,3486467134,2448914107,a1d08f55b01f23bac36541bbfcefff576ee4cda5,7d9ec120202a5c902dc86656375b94e8f280c828,c,c
    ::#,2104,ret,pl-pl,3510453171,2469581370,ddca3dc619575b6239992905e83eb72701b7191a,0d638f5c8ff76e11f8464db24edc0f8c36541c9b,d,c
    ::#,2104,ret,pt-br,3433400174,2434211743,912d33c9966c7e0a862aae613e2c4145589999e2,41813a714de05addaf3a4b02cac8557c25d3e806,c,c
    ::#,2104,ret,pt-pt,3535822654,2484133492,0d2421026b012068619110243334a88965712f00,51800d549e9e4a32a4ae6f404c605dfba3ba91b6,c,c
    ::#,2104,ret,ro-ro,3470071300,2430562330,b6926b751dcd58b572590116723d4241dd28c6c9,bd1020c49267307bbdf44bd826cf20faf3d3af9b,c,d
    ::#,2104,ret,ru-ru,3430462123,2439075996,15618188a00a7b2aaa68f4c6b87e08e6a4f07331,2da475bad89ef745dcdff6a413d6e8db49a904c4,c,c
    ::#,2104,ret,sk-sk,3472395000,2438053195,91676e5f331b1d81aabe71d5af53d90ac06cbcb4,9b5b5a361d7c5638890434c3bd74edcaac626df0,d,c
    ::#,2104,ret,sl-si,3467607426,2436717792,0e7ba031304d95d6202f5f3aa78f6049757b7f60,33492aeb6478317d0e9793002e4c6ef39421e51e,c,c
    ::#,2104,ret,sr-rs,3355604758,2369715360,43a28859d5ddc27fa21147571fd6ecbad9c98220,b13bb12981a58f7876ad1910e53fd9facebcb2c9,c,c
    ::#,2104,ret,sv-se,3490204035,2446984416,05b82ac7e0ad862ba29573f280c6b8b2d747d648,d5ddee9e1009b8c18d2c0d953e5c6ee17cf4fc29,d,d
    ::#,2104,ret,th-th,3365799411,2387008722,c685e53c6964b12610fe992b944ae9508f6a1075,eb1aa56bfcba59de613e9a6791c2153e8c630d14,d,c
    ::#,2104,ret,tr-tr,3366531784,2382181877,b143bb0768e0a6f4719a9a8b1467d7f9e0a9d1df,99595f2eeeea27af8f3da15722607ee8d51052c4,d,c
    ::#,2104,ret,uk-ua,3365431030,2388921054,2845ae86d8d208857c7b52dc2c65464fd76dc189,63ac937cc9626a1fb21f9c451b882ab546e58aa6,c,c
    ::#,2104,ret,zh-cn,3625775339,2633078381,16f2c8adba14b6e7b24f07f3621106d0dc8189f7,f4ad3c3fb95b343e91f0ebc7945159778b886596,c,c
    ::#,2104,ret,zh-tw,3571725237,2592639970,ca4f59345e2fec51bca8253496671c8948d68c0f,82a0b0edbcc5edf978fa7f675eff04ff925783a0,d,d
    ::#,2104,vol,ar-sa,3341084108,2375376521,7b726b5d3cf791b7011aafcd194e4b947f9e53ff,2b4b190883d837bfdf9e80d54974aa3d45598fbf,d,d
    ::#,2104,vol,bg-bg,3421952216,2404858323,d0296755e807b75e785499a900eed15506fa185d,7f2c4306e024bcc38c3bf0452c79dfd69924d0fc,d,d
    ::#,2104,vol,cs-cz,3420160791,2398991746,884398308ddc9604f57add32ec182bb2efda940a,6a34fa7e86527bbe740b9e85264dec3f3928d3fe,d,d
    ::#,2104,vol,da-dk,3442516700,2415701476,6a4a23ebdf5b3e6358afb9cb9542c1263a204072,e39861e1a1ff240ba985aa5658062f4bf5693d89,d,d
    ::#,2104,vol,de-de,3552197944,2526545564,aa63ebd64db00448b05fda53986fd62ebc2c095a,12644ff169aec3e5f915683174c3e796e84352e7,d,d
    ::#,2104,vol,el-gr,3437280956,2411101034,cf43f46e791ed33385608d6e62f50b8b321301c4,2ffc231702c1cdb054c984251f9b56085625779d,c,c
    ::#,2104,vol,en-gb,3507237256,2488309969,324def1a416eddab9061aeb0090bd3fb17960aa7,dddfcd8b502c82a1cc87f9587fddccf0f12be3e4,c,c
    ::#,2104,vol,en-us,3509875534,2493281809,2135b936d88de16cd585b27c4707aaf1876f0081,93c71567631d41427e0fb609e1cd94a6baae162c,c,c
    ::#,2104,vol,es-es,3514853106,2494311510,509f7641f6ee40c568462db30de1bf9919876fbe,d14909554b7386715556f5c690a758a52b607359,c,c
    ::#,2104,vol,es-mx,3342179694,2371282915,de0a1c6b8554fc27908ee580bd116b036238fa98,3c94bcfaee9a58f55bd8db0c62826db874d65ca0,c,c
    ::#,2104,vol,et-ee,3391418350,2375949998,8497846e8c1d9fe924e96eb6f34518ffb6355a06,8f8c3413473031a6c40990fce69ccc40fb37654b,c,c
    ::#,2104,vol,fi-fi,3424627794,2401706988,85d821b199805aa16423ae1891972fa4cbec1cea,aa42bff68443d235549a6c3d7e51a28490eb89d2,c,d
    ::#,2104,vol,fr-ca,3374111900,2412293393,e7eeaa36c1d9d64638fd612841d8d20e1db73450,5c93ccd68ad26a3259abe4f62cea81eb37e49999,c,c
    ::#,2104,vol,fr-fr,3517970344,2492933272,06dd9261ebde2fcb39adbca839225fe1058de232,6e8db2685c5c3085d167cb4f9c7068cf9df49637,c,c
    ::#,2104,vol,he-il,3329516504,2365577555,d1d5bd55934c65ff5cfe07731dac2b99126700b5,093055005b7a2b2876afbe1c1e712364c601841c,c,c
    ::#,2104,vol,hr-hr,3395247379,2380408356,8e1b6142338cc8eb2f66b261979a9d560ccbfca2,94cc66c2a7a3b3c600ae0f56544a28c86f88084a,c,c
    ::#,2104,vol,hu-hu,3420565423,2392924152,7ab613b7a735ad0f183ddbe60be43fbe32a2e9ba,94c94eabea572fecffb4175b93a3a1e6678d47ca,c,c
    ::#,2104,vol,it-it,3472488509,2445623938,e9e7dddc94c71d3fa6f533c7e24418905087849e,d58141af4d15a3e7385c8224d98d30092b0ccd1f,c,c
    ::#,2104,vol,ja-jp,3517231294,2549317356,1aada86bb01c4cf439e18e0ac2d0a3a716bc5f5a,bc592b392602a48001c09f256f611188f7293001,c,c
    ::#,2104,vol,ko-kr,3344813066,2375057201,85f2e8942cd15804e55888ae0597756d7f5c014a,2963bc8602354545b32e946733a4d756638238a1,c,d
    ::#,2104,vol,lt-lt,3393098086,2375151446,4169dca3d5bc523b1a3c4e96b72bd8d5aba42143,737ddfe6a0d5e9c391acb3574bee3876cf9184bf,c,c
    ::#,2104,vol,lv-lv,3392012200,2375795382,5065cb9bd3311bd9d1c32f2028f42e1dcef83d4a,ad12046ceaed65a8bce4974e1fc3f58b7f70e894,c,c
    ::#,2104,vol,nb-no,3415496264,2393425310,3080d366ec4e501f67e03f9617acdf38b9c96bd3,71900c76e96e7c1d5ef7ac52c608a3b668ab0832,c,c
    ::#,2104,vol,nl-nl,3419245622,2397302280,f6ba09cdfda0ffed7009f64c304989f84d134be0,ab526e32456203ed00d5d27de068abab11da6b52,c,c
    ::#,2104,vol,pl-pl,3440364700,2418754350,e9319ed0e89a1192ff0d826fa7fa36f8e510ef5c,4b7633e3d28cf2276e5a5b9695d8306c52a5b80c,c,c
    ::#,2104,vol,pt-br,3345850040,2376304550,90014f30ea8d2af2910d2a224bf07cd0fa56d01b,f2080c942d0af9da977f222d9a63d739b54f00b7,c,c
    ::#,2104,vol,pt-pt,3443097496,2416031504,b71070a09e0c28732c0bd65b9220a8e76047881c,2a927bdbdd1d25e9c8cab6f77abe5cfd850de677,c,c
    ::#,2104,vol,ro-ro,3397184771,2378288782,0294ccd5361dd68564df06b15f5861509ff42f2f,c4c8b2fcf01e6e93c75feb9a203afbf48ec7ba48,c,c
    ::#,2104,vol,ru-ru,3348430457,2376559456,3be190a99ff7c8d5c07f684dbf48cbd15ef8d95c,ecf956d818fb51e09537d7ce01a4a2811d814a7f,c,c
    ::#,2104,vol,sk-sk,3396387777,2386130552,76d03095b441d6e6de3dd060eed4edc1e7fd94d4,d61fa69bab745a05e2e88dbd529b6c583728164f,c,c
    ::#,2104,vol,sl-si,3394144727,2383526433,57e6df99eef2fbc7727829f477a358370b3923e8,790ba45494fb6e6504a184a4bbdf85ecc7b96650,c,c
    ::#,2104,vol,sr-rs,3268732574,2307209874,befa48a8f84ea27df6819ea6aa030162669a0186,94b56fd50585acfdc4fc7d0cf5fbe56207250d34,c,c
    ::#,2104,vol,sv-se,3424841494,2398611714,e8f5aa841e98da97cdccdff52dc548bd1d0e9922,4034965de177ea90d0eda0405e10d81239ca882d,c,c
    ::#,2104,vol,th-th,3287839483,2326053312,89e06fa89fe3cf51471c22f6506e4dddfdc66b37,05bafc474f9438fbf4363659d0bda20282c463e6,c,c
    ::#,2104,vol,tr-tr,3287347870,2321505852,d014b23612b3ccfab23b92f8780d13e9d4e1d9f4,9e185aa9e01586d95c3b2e88d6dc29fd23126f24,c,c
    ::#,2104,vol,uk-ua,3286940134,2325136249,77319b2abf7e3b71b23b172eae57e7ecb9013dfa,79cba3f9db9785630bc5c850a3693f7304ba1946,c,c
    ::#,2104,vol,zh-cn,3537934417,2572165582,194c3263269f22283e1d8b98265d03ea3ef03127,cff8cfd761bf2d52a5fd35c57104ca2157f7bab0,c,c
    ::#,2104,vol,zh-tw,3513037723,2550894991,D90D9F422BDBC7E1D13CB6FF50603A8887B3CF78,9B788763FD0867BAA7EC2FED3CF3CA9843A48A24,c,c
    ::#,2004,ret,ar-sa,3424376474,2443826666,b318889964b75cef3a69ec75d28c7ef174157fac,34627c10a75e32440b8655fce3fa160b2561f81e,d,d
    ::#,2004,ret,bg-bg,3497891524,2461077962,89768c1292bb00d8bc59cc93a8bd31bf86fd0d60,b445575585fafced162431c8e491f35b20541083,c,d
    ::#,2004,ret,cs-cz,3489284116,2457579642,47089fda0dbd90725a7de74dcbe18edd8b10ffd5,b5a47c13798de6d47e39d82795d300c826e3e9b6,c,c
  19. AveYo revised this gist Dec 11, 2020. 2 changed files with 47 additions and 30 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,5 @@
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    ```
    76 changes: 46 additions & 30 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,11 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.12.01
    :: - attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    :: Changelog: 2020.12.11
    :: - updated 20H2; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
    :: - fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    :: - generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    :: - 2009: 19042.572 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112
    :: - 2009: 19042.631 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2]

    @@ -49,10 +49,10 @@ if not defined MCT_VERSION call :choices MCT_VERSION "%CHOICES%" 11 "Create Wind
    %<%:e1 " NO MCT_VERSION SELECTED "%>% & popd & timeout /t 5 >nul & exit/b

    :version-11
    set "V=2009" & set "B=19042.572.201009-1947.20h2_release_svc_refresh" & set "D=2020/10/" & set "C=1.4.1"
    set "CAB=http://download.microsoft.com/download/4/5/e/45eabe71-8b8f-487f-b591-314be20231d3/products_20201013.cab"
    set "V=2009" & set "B=19042.631.201119-0144.20h2_release_svc_refresh" & set "D=2020/11/" & set "C=1.4.1"
    set "CAB=http://download.microsoft.com/download/4/3/0/430e9adb-cf08-4b68-9032-eafca8378d42/products_20201119.cab"
    set "MCT=http://download.microsoft.com/download/4/c/c/4cc6c15c-75a5-4d1b-a3fe-140a5e09c9ff/MediaCreationTool20H2.exe"
    :: just a 2004 with an integrated enablement package to mainly bundle ChrEdge; bloats install.esd file above 4GB FAT32 limit!
    :: just a 2004 with an integrated enablement package to mainly bundle ChrEdge and bloat install.esd
    goto process

    :version-10
    @@ -100,11 +100,12 @@ set "MCT=http://download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F
    goto process

    :version-4
    set "V=1703" & set "B=15063.0.170710-1358.rs2_release_svc_refresh" & set "D=2017/07/" & set "C=1.0"
    set "XML=http://download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    set "V=1703" & set "B=15063.0.170317-1834.rs2_release" & set "D=2017/03/" & set "C=1.0"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=15063.0.170710-1358.rs2_release_svc_refresh" & set "D=2017/07/"
    rem set "XML=http://download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    rem above refreshed xml often fails decrypting dual x86 + x64 - using rtm instead; the added enterprise + cloud are refreshed
    set "CAB=http://download.microsoft.com/download/9/5/4/954415FD-D9D7-4E1F-8161-41B3A4E03D5E/products_20170317.cab"
    set "MCT=http://download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35B8FA35EC3F/MediaCreationTool.exe"
    rem 1703 MCT works in all my tests, but some people are experiencing issues, so using 1607 MCT instead
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: some gamers still find it the best despite unfixed memory allocation bugs and exposed cpu flaws; can select Cloud (S)
    goto process

    @@ -167,9 +168,10 @@ function Choices ($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc=
    :: remove unsupported options in older versions
    if %V% LSS 1703 echo %OPTIONS% | findstr /c:"/DiagnosticPrompt enable" >nul && set "OPTIONS=%OPTIONS:/DiagnosticPrompt enable=%"
    if %V% LSS 1709 echo %OPTIONS% | findstr /c:"/Console" >nul && set "OPTIONS=%OPTIONS:/Console=%"
    :: cleanup workfolders; do one-time clear of cached MCT as script generates proper 1.0 catalog for 1507,1511,1703 since 2020.11.14
    :: cleanup workfolder
    (del /f /q products.* & rd /s/q %systemdrive%\$Windows.~WS %systemdrive%\$WINDOWS.~BT) 2>nul
    if not exist latest del /f /q *.exe 2>nul & cd.>latest
    set latest=0 & if exist latest set/p latest=<latest
    if %latest% LSS 20201211 del /f /q products*.* MediaCreationTool*.exe 2>nul & echo,20201211>latest

    :: download MCT and CAB / XML
    set "DOWN=function dl($u,$f){$w=new-object System.Net.WebClient; $w.Headers.Add('user-agent','ipad'); try{$w.DownloadFile($u,$f)}"
    @@ -184,20 +186,21 @@ if defined XML if exist products%V%.xml copy /y products%V%.xml products.xml >nu
    if defined CAB echo;%CAB%
    if defined CAB if not exist products%V%.cab powershell -nop -c "%DOWN% %LOAD% $env:CAB 'products%V%.cab'" 2>nul
    if defined CAB if not exist products%V%.cab %<%:1e " products%V%.cab download failed "%>%
    if exist products%V%.cab del /f /q products%V%.xml 2>nul
    if exist products%V%.cab expand.exe -R products%V%.cab -F:* . >nul 2>nul
    set success=1 &for %%s in (products.xml MediaCreationTool%V%.exe) do if not exist %%s set "success="
    echo; & if defined success ( %<%:0f " MCT starts after configuring products.xml, please wait..."%>% ) else (
    %<%:4f " ERROR "%>>% & %<%:0f " Check urls in browser | del MCT dir | unblock powershell | enable BITS serv "%>% &pause &exit/b )

    :: configure products.xml - editing in one go
    set "0=%~f0" & powershell -nop -c $f0=[io.file]::ReadAllText($env:0);iex(($f0-split':PRODUCTS_XML\:.*')[1]) & goto :PRODUCTS_XML:
    [xml]$xml = [IO.File]::ReadAllText('./products.xml',[Text.Encoding]::UTF8); $root = $xml.SelectSingleNode('/PublishedMedia')
    $ver = $env:V
    [xml]$xml = [IO.File]::ReadAllText("$pwd\products.xml",[Text.Encoding]::UTF8)
    $ver = $env:V; if ($ver -eq 2009) {$vers = "20H2"} else {$vers = $ver}

    ## apply/insert Catalog version attribute for MCT compatibility
    if ($null -ne $xml.MCT) {
    $xml.MCT.Catalogs.Catalog.version = $env:C; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    } else {
    } else { if ($ver -eq 1703) {$root = $xml.SelectSingleNode('/PublishedMedia');continue}
    $temp = [xml]('<?xml version="1.0" encoding="UTF-8"?><MCT><Catalogs><Catalog version="' + $env:C + '"/></Catalogs></MCT>')
    $null = $temp.SelectSingleNode('/MCT/Catalogs/Catalog').AppendChild($temp.ImportNode($xml.PublishedMedia,$true))
    $xml = $temp; $root = $xml.SelectSingleNode('/MCT/Catalogs/Catalog/PublishedMedia')
    @@ -215,39 +218,48 @@ $tmp = [xml]('<EULA><LanguageCode/><URL/></EULA>'); $el = $xml.CreateElement('EU
    $null = $root.AppendChild($el)
    }

    ## friendlier version + combined consumer editions label (not doing it for business too here as it would be ignored by mct)
    if ($null -ne $root.Languages) {
    if ($ver -gt 1511) {$CONSUMER = "$vers Home | Pro | Edu"} else {$CONSUMER = "$vers Home | Pro"}
    foreach ($i in $root.Languages.Language) {
    foreach ($l in $i.ChildNodes) {$label = $i.$($l.LocalName); $i.$($l.LocalName) = $label.replace("Windows 10", "$vers")}
    if ($null -ne $i.CLIENT) {$i.CLIENT = "$CONSUMER"} ; if ($null -ne $i.CLIENT_K) {$i.CLIENT_K = "$CONSUMER K"}
    if ($null -ne $i.CLIENT_N) {$i.CLIENT_N = "$CONSUMER N"} ; if ($null -ne $i.CLIENT_KN) {$i.CLIENT_KN = "$CONSUMER KN"}
    }
    }

    ## unhide combined business editions in xml that include them: 1709 - 20H2; unhide Education on 1507 - 1511; better edition label
    if ($env:UNHIDE_BUSINESS -ge 1) {
    if ($ver -gt 1511) {$CONSUMER = 'Home | Pro | Edu'} else {$CONSUMER = 'Home | Pro'}
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64') {continue} ; $edi = $f.Edition; $loc = $f.Edition_Loc
    if ($edi -eq 'Enterprise') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = 'Windows 10 vl Enterprise | Pro | Edu'}
    if ($edi -eq 'Enterprise') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = "$vers Enterprise | Pro | Edu vl"}
    if ($ver -le 1511 -and ($edi -eq 'Education' -or $edi -eq 'EducationN')) {$f.IsRetailOnly = 'False'}
    if ($ver -eq 1703 -and $edi -eq 'Cloud') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = 'Windows 10 S'}
    if ($ver -eq 1703 -and $edi -eq 'CloudN') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = 'Windows 10 SN'}
    if ($ver -le 1703 -and $loc -eq '%CLIENT_N%') {$f.Edition_Loc = "Windows 10 $CONSUMER N"}
    if ($loc -eq '%CLIENT%') {$f.Edition_Loc = "Windows 10 $CONSUMER"}
    }
    }

    ## insert individual business editions in xml that never included them: 1607, 1703
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://wsus.ds.download.windowsupdate.com/'
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://fg.ds.b1.download.windowsupdate.com/'
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,1511 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';edu='Education';edN='EducationN';pro='Professional';prN='ProfessionalN'}
    ## insert business entries for 1511, 1607, 1703
    $edi = @{ent='Enterprise';enN='EnterpriseN';pro='Professional';prN='ProfessionalN';edu='Education';edN='EducationN';
    clo='Cloud';clN='CloudN'}
    ## insert business entries for 1607, 1703
    if ($ver -le 1703) {
    $files = $root.Files.File |where {$_.Edition -eq "Education" -and $_.Architecture -ne 'ARM64'}
    foreach ($e in 'ent','enN','pro','prN','edu','edN') {
    foreach ($e in 'ent','enN','pro','prN','edu','edN','clo','clN') {
    $items = $csv |where {$_.Client -eq $e} |group Lang -AsHashTable -AsString; if ($null -eq $items) {continue}
    $up = '/upgr/'; if ($ver -eq 1607 -and $e -like 'en*') {$up = '/updt/'}
    $cli = '_CLIENT' + $edi[$e].toupper(); if ($e -like 'p*') {$cli += 'VL_VOL_'} else {$cli += '_VOL_'}
    $cli = '_CLIENT' + $edi[$e]; $up = '/upgr/'; if ($ver -eq 1607 -and $e -like 'en*') {$up = '/updt/'} #.toupper();
    if ($e -like 'cl*') {$cli += '_RET_'} elseif ($e -like 'p*') {$cli += 'VL_VOL_'} else {$cli += '_VOL_'}
    if ($e -like 'cl*') {$BUSINESS = $edi[$e] -replace 'Cloud','S'} else {$BUSINESS = $edi[$e] -creplace 'N',' N'}
    foreach ($f in $files) {
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items[$lang]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly = 'False'; $c.Edition = $edi[$e]
    $name = $env:B + $cli + $arch + 'FRE_' + $lang; $c.Size = $i[0]; $c.Sha1 = $i[1]
    $c.FileName = $name + '.esd'; $c.FilePath = $url + $i[2] + $up + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    $c.Edition_Loc = 'Windows 10 vl '+($edi[$e] -creplace 'N',' N'); $null = $root.Files.AppendChild($c)
    $c.Edition_Loc = "$vers $BUSINESS"
    $null = $root.Files.AppendChild($c)
    }
    }
    }
    @@ -264,8 +276,7 @@ if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,15
    }
    }
    }

    $xml.Save('./products.xml')
    $xml.Save("$pwd\products.xml")
    :PRODUCTS_XML: edited!

    :: repack XML into CAB
    @@ -283,6 +294,9 @@ set "\=%\%; $sources=$env:SystemDrive+'\$Windows.~WS\Sources\Windows\sources\';
    set "\=%\%; for (;;) {sleep 20; if(Test-Path $setup){break} ; if((gwmi -Class Win32_Process -Filter $f).ProcessId -le 0){break}}"
    set "\=%\%; if (Test-Path $setup) {xcopy /CYBERHIQ '..\$OEM$' ([char]34 + $sources + '$OEM$' + [char]34)} ; exit 0"

    :: add a short delay to see the script output since the xml processing is too fast :D
    timeout 3 >nul

    :: finally launch MCT executable with local configuration and optional launch parameters
    powershell -win 1 -nop -c "$MCT=start MediaCreationTool%V%.exe -args $env:OPTIONS -passthru; %\%" 2>nul

    @@ -291,7 +305,7 @@ exit || DONE! AveYo: can skip some or all entries below if not interested in upd
    :: Insert business esd links in 1511,1607,1703; UPDATE 1909 and 2004 by hand until getting a products.xml url from microsoft
    :: Following are condensed ver,edition,lang,sizes,hashes,dirs to be recomposed into full official ESD links for MCT
    :: I have chosen to generate them on-the-fly here instead of linking to third-party hosted pre-edited products.xml
    :: [Dev] ESD name has all except size; can get it with (Invoke-WebRequest -Uri 'url' -Method Head).Headers['Content-Length'])
    :: [Dev] ESD name has all except size; can get it with (Invoke-WebRequest -Uri $url -Method Head).Headers['Content-Length']
    :PS_UPDATE_BUSINESS_CSV:_,Ver,Client,Lang,Size_x64,Size_x86,Sha1_x64,Sha1_x86,Dir_x64,Dir_x86
    ::#,2004,ret,ar-sa,3424376474,2443826666,b318889964b75cef3a69ec75d28c7ef174157fac,34627c10a75e32440b8655fce3fa160b2561f81e,d,d
    ::#,2004,ret,bg-bg,3497891524,2461077962,89768c1292bb00d8bc59cc93a8bd31bf86fd0d60,b445575585fafced162431c8e491f35b20541083,c,d
    @@ -445,6 +459,8 @@ exit || DONE! AveYo: can skip some or all entries below if not interested in upd
    ::#,1909,vol,uk-ua,3392754222,2413347222,2d69506768fdcea8dbba9db817f3061abf185147,b07a76669c2b2a7e90b0810d0c95f8719946392b,d,d
    ::#,1909,vol,zh-cn,3649266478,2647047456,47102873fd333e715f06c840e08a149963cfb6a4,8e1f607553ab7980c0c9ded018d8352b529320a4,d,d
    ::#,1909,vol,zh-tw,3629284727,2627531775,c4e3cea8745b894726133b81b9ad63c7344272b9,845b5ce812931b1cfcd665ee11b223549721bbee,d,c
    ::#,1703,clo,en-us,3315033420,2546331272,7e8eae476222bbb48de04862a8ac85bdd563461c,9d92ec014d1dcc4d1968b33e9cc9bc0748e07bcd,d,d
    ::#,1703,clN,en-us,3144657572,2437732564,e69925fec9aebc5fbf3852086ecb4c3fe00dfc2e,0fcc1248ab6ac55cae7ec24be5b21ff163d34fc1,c,c
    ::#,1703,enN,bg-bg,3063703618,2343397300,859fd1064516d2d86970313e20682c3f2da3b0f7,3f2d95b5af40290989b42d7e85fb73c2deecb107,c,c
    ::#,1703,enN,cs-cz,3063480034,2339478712,5885cef1a0a88972eafbf3240a91944a5bbaef0c,ebb7e9db690c146503c1470f6431ebb3b9f90b8d,d,d
    ::#,1703,enN,da-dk,3064590226,2359187156,049db05e06fc85f2e4fa47daf620a91219f94da7,bc154a20faed8cb135617ea5f7c804a78b041663,c,c
  20. AveYo revised this gist Dec 1, 2020. 2 changed files with 6 additions and 3 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -20,4 +20,5 @@
    fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    ```
    8 changes: 5 additions & 3 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.11.17
    :: - one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507-1703; version from commandline
    :: Changelog: 2020.12.01
    :: - attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
    :: - fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    :: - generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    :: - 2009: 19042.572 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112
    @@ -103,6 +103,8 @@ goto process
    set "V=1703" & set "B=15063.0.170710-1358.rs2_release_svc_refresh" & set "D=2017/07/" & set "C=1.0"
    set "XML=http://download.microsoft.com/download/2/E/B/2EBE3F9E-46F6-4DB8-9C84-659F7CCEDED1/products20170727.xml"
    set "MCT=http://download.microsoft.com/download/1/F/E/1FE453BE-89E0-4B6D-8FF8-35B8FA35EC3F/MediaCreationTool.exe"
    rem 1703 MCT works in all my tests, but some people are experiencing issues, so using 1607 MCT instead
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    :: some gamers still find it the best despite unfixed memory allocation bugs and exposed cpu flaws; can select Cloud (S)
    goto process

    @@ -228,7 +230,7 @@ if ($env:UNHIDE_BUSINESS -ge 1) {
    }

    ## insert individual business editions in xml that never included them: 1607, 1703
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://ds.download.windowsupdate.com/'
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://wsus.ds.download.windowsupdate.com/'
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,1511 -contains $ver) {
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';edu='Education';edN='EducationN';pro='Professional';prN='ProfessionalN'}
  21. AveYo revised this gist Nov 17, 2020. 2 changed files with 8 additions and 5 deletions.
    4 changes: 2 additions & 2 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -16,8 +16,8 @@
    2020.10.30: hotfix utf-8, enterprise on 1909+
    2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
    2020.11.14: generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    2020.11.15: finally stable
    one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    2020.11.15: one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    updated executables links for 1903 and 2004
    2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    ```
    9 changes: 6 additions & 3 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.11.15 finally stable
    :: - one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    :: Changelog: 2020.11.17
    :: - one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507-1703; version from commandline
    :: - fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    :: - generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    :: - 2009: 19042.572 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112
    @@ -35,6 +35,9 @@ set OPTIONS=%OPTIONS% /MigrateDrivers All /ResizeRecoveryPartition Disable /Show
    set OPTIONS=%OPTIONS% /Telemetry Disable

    :: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
    :: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
    for %%V in (1.1507 2.1511 3.1607 4.1703 5.1709 6.1803 7.1809 8.1903 9.1909 10.2004 11.2009) do if %%~xV==.%1 set MCT_VERSION=%%~nV

    :: handle auto upgrade scenario without user intervention when script was renamed to "auto MediaCreationTool.bat"
    for /f %%s in ("%~n0") do if /i %%s EQU auto if not defined MCT_VERSION set MCT_VERSION=11

    @@ -43,7 +46,7 @@ if not defined MCT_VERSION call :choices MCT_VERSION "%CHOICES%" 11 "Create Wind
    @goto version-%MCT_VERSION%

    :version-0
    %<%:e1 " NO MCT_VERSION SELECTED "%>% & timeout /t 5 >nul & exit/b
    %<%:e1 " NO MCT_VERSION SELECTED "%>% & popd & timeout /t 5 >nul & exit/b

    :version-11
    set "V=2009" & set "B=19042.572.201009-1947.20h2_release_svc_refresh" & set "D=2020/10/" & set "C=1.4.1"
  22. AveYo revised this gist Nov 15, 2020. 2 changed files with 3 additions and 2 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,5 @@
    2020.11.15: finally stable
    one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    updated executables links for 1903 and 2004
    ```
    4 changes: 2 additions & 2 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,7 @@ goto process
    set "V=2004" & set "B=19041.508.200907-0256.vb_release_svc_refresh" & set "D=2020/09/" & set "C=1.4"
    if %UPDATE_BUSINESS%0 GEQ 1 set "B=19041.572.201009-1946.vb_release_svc_refresh" & set "D=2020/11/"
    set "CAB=http://download.microsoft.com/download/7/4/4/744ccd60-3203-4eea-bfa2-4d04e18a1552/products.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe"
    set "MCT=http://software-download.microsoft.com/download/pr/8d71966f-05fd-4d64-900b-f49135257fa5/MediaCreationTool2004.exe"
    :: visible improvements to windows update, defender, search, dx12, wsl, sandbox; pushing ChrEdge update intensifies
    goto process

    @@ -71,7 +71,7 @@ goto process
    :version-8
    set "V=1903" & set "B=18362.356.190909-1636.19h1_release_svc_refresh" & set "D=2019/09/" & set "C=1.3"
    set "CAB=http://download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1903.exe"
    set "MCT=http://download.microsoft.com/download/9/8/8/9886d5ac-8d7c-4570-a3af-e887ce89cf65/MediaCreationTool1903.exe"
    :: modern windows 10 starts here with proper memory allocation, cpu scheduling, security features
    goto process

  23. AveYo revised this gist Nov 15, 2020. 2 changed files with 43 additions and 37 deletions.
    3 changes: 3 additions & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,7 @@
    2020.10.30: hotfix utf-8, enterprise on 1909+
    2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
    2020.11.14: generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    2020.11.15: finally stable
    one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    ```
    77 changes: 40 additions & 37 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,12 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.11.14
    :: Changelog: 2020.11.15 finally stable
    :: - one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
    :: - fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
    :: - generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    :: - 2009: 19042.572 / 2004: 19041.572 / 1909: 18363.1139 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112
    :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 [19H1], 1909 [19H2], 2004 [20H1], 2009 [20H2]

    :: comment to not unhide Enterprise for 1709+ in products.xml
    @@ -31,8 +33,8 @@ set OPTIONS=%OPTIONS% /MigrateDrivers All /ResizeRecoveryPartition Disable /Show

    :: comment to enable default setup telemetry
    set OPTIONS=%OPTIONS% /Telemetry Disable
    :: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    :: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
    :: handle auto upgrade scenario without user intervention when script was renamed to "auto MediaCreationTool.bat"
    for /f %%s in ("%~n0") do if /i %%s EQU auto if not defined MCT_VERSION set MCT_VERSION=11

    @@ -41,7 +43,7 @@ if not defined MCT_VERSION call :choices MCT_VERSION "%CHOICES%" 11 "Create Wind
    @goto version-%MCT_VERSION%

    :version-0
    %<%:e0 " NO MCT_VERSION SELECTED "%>% & timeout /t 5 >nul & exit/b
    %<%:e1 " NO MCT_VERSION SELECTED "%>% & timeout /t 5 >nul & exit/b

    :version-11
    set "V=2009" & set "B=19042.572.201009-1947.20h2_release_svc_refresh" & set "D=2020/10/" & set "C=1.4.1"
    @@ -129,9 +131,9 @@ set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68
    goto process

    :init script
    @echo off & title %1 & color 9f &rem mode 120,30
    :: self-echo top 2-18 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,18) do set \=& set/p \=& call echo;%%\%%)
    @echo off & title %1 & color 1f & mode 120,30
    :: self-echo top 2-20 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,20) do set \=& set/p \=& call echo;%%\%%)
    :: lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    for /f "delims=:" %%\ in ('echo;prompt $h$s$h:^|cmd/d') do set "|=%%\" &set ">>=\..\c nul &set/p \=%%\%%\%%\%%\%%\%%\%%\<nul&popd"
    set "<=pushd "%allusersprofile%"&2>nul findstr /c:\ /a" &set ">=%>>%&echo;" &set "|=%|:~0,1%" &set/p \=\<nul>"%allusersprofile%\c"
    @@ -156,29 +158,30 @@ function Choices ($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc=
    if ($global:rez -ne $ch.length) {exit $global:rez} else {exit 0} } :PS_CHOICES: gui choices returning index - snippet by AveYo

    :process selected
    %<%:f0 " Windows 10 Version "%>>% & %<%:af " %V% "%>>% & %<%:f9 " %B% "%>>% & %<%:99 ~%>% & echo;
    %<%:f0 " Windows 10 Version "%>>% & %<%:2f " %V% "%>>% & %<%:f1 " %B% "%>>% & %<%:11 ~%>% & echo;
    :: remove unsupported options in older versions
    if %V% LSS 1703 echo %OPTIONS% | findstr /c:"/DiagnosticPrompt enable" >nul && set "OPTIONS=%OPTIONS:/DiagnosticPrompt enable=%"
    if %V% LSS 1709 echo %OPTIONS% | findstr /c:"/Console" >nul && set "OPTIONS=%OPTIONS:/Console=%"
    :: cleanup workfolders
    :: cleanup workfolders; do one-time clear of cached MCT as script generates proper 1.0 catalog for 1507,1511,1703 since 2020.11.14
    (del /f /q products.* & rd /s/q %systemdrive%\$Windows.~WS %systemdrive%\$WINDOWS.~BT) 2>nul
    if not exist latest del /f /q *.exe 2>nul & cd.>latest

    :: download MCT and CAB / XML
    set "DOWN=function dl($u,$f){$w=new-object System.Net.WebClient; $w.Headers.Add('user-agent','ipad'); try{$w.DownloadFile($u,$f)}"
    set "LOAD=catch [System.Net.WebException] {write-host -non ';('; del $f -force -ea 0} finally{$w.Dispose()} } ; dl"
    if defined MCT echo;%MCT%
    if not exist MediaCreationTool%V%.exe powershell -nop -c "%DOWN% %LOAD% $env:MCT 'MediaCreationTool%V%.exe'" 2>nul
    if not exist MediaCreationTool%V%.exe %<%:96 " MediaCreationTool%V%.exe download failed "%>%
    if not exist MediaCreationTool%V%.exe %<%:1e " MediaCreationTool%V%.exe download failed "%>%
    if defined XML echo;%XML%
    if defined XML if not exist products%V%.xml powershell -nop -c "%DOWN% %LOAD% $env:XML 'products%V%.xml'" 2>nul
    if defined XML if not exist products%V%.xml %<%:90 " products%V%.xml download failed "%>%
    if defined XML if not exist products%V%.xml %<%:1e " products%V%.xml download failed "%>%
    if defined XML if exist products%V%.xml copy /y products%V%.xml products.xml >nul 2>nul
    if defined CAB echo;%CAB%
    if defined CAB if not exist products%V%.cab powershell -nop -c "%DOWN% %LOAD% $env:CAB 'products%V%.cab'" 2>nul
    if defined CAB if not exist products%V%.cab %<%:90 " products%V%.cab download failed "%>%
    if defined CAB if not exist products%V%.cab %<%:1e " products%V%.cab download failed "%>%
    if exist products%V%.cab expand.exe -R products%V%.cab -F:* . >nul 2>nul
    set success=1 &for %%s in (products.xml MediaCreationTool%V%.exe) do if not exist %%s set "success="
    echo; & if defined success ( %<%:1f " MCT starts after configuring products.xml, please wait..."%>% ) else (
    echo; & if defined success ( %<%:0f " MCT starts after configuring products.xml, please wait..."%>% ) else (
    %<%:4f " ERROR "%>>% & %<%:0f " Check urls in browser | del MCT dir | unblock powershell | enable BITS serv "%>% &pause &exit/b )

    :: configure products.xml - editing in one go
    @@ -200,8 +203,8 @@ $eula = 'http://download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69
    if ($null -ne $root.EULAS) {
    foreach ($i in $root.EULAS.EULA) {$i.URL = $eula + $i.LanguageCode.ToUpper() + $rtf}
    } else {
    $tmp = [xml]('<EULA><LanguageCode/><URL/></EULA>'); $el = $xml.CreateElement('EULAS'); $node = $xml.ImportNode($tmp.EULA,$true)
    foreach ($lang in ($root.Languages.Language |where LanguageCode -ne 'default')) {
    $tmp = [xml]('<EULA><LanguageCode/><URL/></EULA>'); $el = $xml.CreateElement('EULAS'); $node = $xml.ImportNode($tmp.EULA,$true)
    foreach ($lang in ($root.Languages.Language |where {$_.LanguageCode -ne 'default'})) {
    $i = $el.AppendChild($node.Clone()); $lc = $lang.LanguageCode; $i.LanguageCode = $lc; $i.URL = $eula + $lc.ToUpper() + $rtf
    }
    $null = $root.AppendChild($el)
    @@ -211,7 +214,7 @@ if ($null -ne $root.EULAS) {
    if ($env:UNHIDE_BUSINESS -ge 1) {
    if ($ver -gt 1511) {$CONSUMER = 'Home | Pro | Edu'} else {$CONSUMER = 'Home | Pro'}
    foreach ($f in $root.Files.File) {
    if ($e.Architecture -eq 'ARM64') {continue} ; $edi = $f.Edition; $loc = $f.Edition_Loc
    if ($f.Architecture -eq 'ARM64') {continue} ; $edi = $f.Edition; $loc = $f.Edition_Loc
    if ($edi -eq 'Enterprise') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = 'Windows 10 vl Enterprise | Pro | Edu'}
    if ($ver -le 1511 -and ($edi -eq 'Education' -or $edi -eq 'EducationN')) {$f.IsRetailOnly = 'False'}
    if ($ver -eq 1703 -and $edi -eq 'Cloud') {$f.IsRetailOnly = 'False'; $f.Edition_Loc = 'Windows 10 S'}
    @@ -222,24 +225,23 @@ if ($env:UNHIDE_BUSINESS -ge 1) {
    }

    ## insert individual business editions in xml that never included them: 1607, 1703
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]
    $lines = ($f0-split':PS_UPDATE_BUSINESS_CSV\:')[1]; $url = 'http://ds.download.windowsupdate.com/'
    if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,1511 -contains $ver) {
    $url = 'http://wsus.ds.b1.download.windowsupdate.com/'
    $csv = ConvertFrom-CSV -Input $lines.replace('sr-rs','sr-latn-rs') |where {$_.Ver -eq $ver}
    $edi = @{ent='Enterprise';enN='EnterpriseN';edu='Education';edN='EducationN';pro='Professional';prN='ProfessionalN'}
    ## insert business entries for 1511, 1607, 1703
    if ($ver -le 1703) {
    $files = $root.Files.File |where {$_.Edition -eq "Education" -and $_.Architecture -ne 'ARM64'}
    foreach ($e in 'ent','enN','pro','prN','edu','edN') {
    $items = $csv |where {$_.Client -eq $e} |group Lang -AsHashTable -AsString; if ($null -eq $items) {continue}
    $upgr = '/upgr/'; if ($ver -eq 1607 -and $e -like 'en*') {$upgr = '/updt/'}
    $cli = '_client' + $edi[$e].tolower(); if ($e -like 'p*') {$cli += 'vl'} ; $chan = '_vol_'
    $up = '/upgr/'; if ($ver -eq 1607 -and $e -like 'en*') {$up = '/updt/'}
    $cli = '_CLIENT' + $edi[$e].toupper(); if ($e -like 'p*') {$cli += 'VL_VOL_'} else {$cli += '_VOL_'}
    foreach ($f in $files) {
    $lang = $f.LanguageCode; $item = $items[$lang]; if ($null -eq $item) {continue}
    $arch = $f.Architecture; $size = $item."Size_$arch"; $sha1 = $item."Sha1_$arch"; $dir = $item."Dir_$arch"
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items[$lang]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $c = $f.Clone(); $c.RemoveAttribute('id'); $c.IsRetailOnly = 'False'; $c.Edition = $edi[$e]
    $c.Size = $size; $c.Sha1 = $sha1; $name = $env:B + $cli + $chan + $arch + 'fre_' + $lang
    $c.FileName = $name + '.esd'; $c.FilePath = $url + $dir + $upgr + $env:D + $name + '_' + $sha1 + '.esd'
    $name = $env:B + $cli + $arch + 'FRE_' + $lang; $c.Size = $i[0]; $c.Sha1 = $i[1]
    $c.FileName = $name + '.esd'; $c.FilePath = $url + $i[2] + $up + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    $c.Edition_Loc = 'Windows 10 vl '+($edi[$e] -creplace 'N',' N'); $null = $root.Files.AppendChild($c)
    }
    }
    @@ -249,14 +251,15 @@ if ($null -ne $lines -and $env:UPDATE_BUSINESS -ge 1 -and 2004,1909,1703,1607,15
    $items = $csv |group Client,Lang -AsHashTable -AsString
    foreach ($f in $root.Files.File) {
    if ($f.Architecture -eq 'ARM64' -or $f.Edition_Loc -eq '%BASE_CHINA%') {continue}
    $cli = '_clientconsumer_'; $chan = 'ret'; if ($f.Edition -like 'Enterprise*') {$cli= '_clientbusiness_'; $chan = 'vol'}
    $lang = $f.LanguageCode; $item = $items["$chan, $lang"]; if ($null -eq $item) {continue}
    $arch = $f.Architecture; $sha1 = $item."Sha1_$arch"; $f.Sha1 = $sha1; $f.Size = $item."Size_$arch"
    $name = $env:B + $cli + $chan + '_' + $arch + 'fre_' + $f.LanguageCode
    $f.FileName = $name + '.esd'; $f.FilePath = $url + $item."Dir_$arch" + '/upgr/' + $env:D + $name + '_' + $sha1 + '.esd'
    $cli = '_CLIENTCONSUMER_'; $chan = 'ret'; if ($f.Edition -like 'Enterprise*') {$cli= '_CLIENTBUSINESS_'; $chan = 'vol'}
    $arch = $f.Architecture; $lang = $f.LanguageCode; $item = $items["$chan, $lang"]; if ($null -eq $item) {continue}
    $i = @(); "Size_$arch","Sha1_$arch","Dir_$arch" |foreach {$i += [string]($item |select -exp $_)}
    $name = $env:B + $cli + $chan.ToUpper() + '_' + $arch + 'FRE_' + $f.LanguageCode; $f.Size = $i[0]; $f.Sha1 = $i[1]
    $f.FileName = $name + '.esd'; $f.FilePath = $url + $i[2] + '/upgr/' + $env:D + $name.tolower() + '_' + $i[1] + '.esd'
    }
    }
    }

    $xml.Save('./products.xml')
    :PRODUCTS_XML: edited!

    @@ -268,17 +271,17 @@ set AUTO_OPTIONS=/Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNo
    for /f %%s in ("%~n0") do if /i %%s NEQ auto (set AUTO=) else set AUTO=1
    if defined AUTO echo %OPTIONS% | findstr /c:"Upgrade" >nul && set "OPTIONS=%OPTIONS% %AUTO_OPTIONS%"

    :: import $OEM$ folder into generated media - for example $OEM$\$$\Setup\Scripts\setupcomplete.cmd gets executed once after setup
    set "@1= $sources=$env:SystemDrive+'\$Windows.~WS\Sources\Windows\sources\'; $setup=$sources+'setupprep.exe';"
    set "@2= if (!($MCT)) {return}; if (!(Test-Path '..\$OEM$')) {return} ; do {"
    set "@3= sleep 20; $r=gwmi -Class Win32_Process -Filter 'Name =''MediaCreationTool%V%.exe'''"
    set "@4= } until (($null -eq $r) -or ((Test-Path $setup) -eq $true)); $oem=[char]34+$sources+'$OEM$'+[char]34;"
    set "@5= if (Test-Path $setup) {mkdir $oem -force; xcopy /CYBERHIQ '..\$OEM$' $oem} ; return"
    :: [Dev] if present, import a $OEM$ folder into generated media - for example a $OEM$\$$\Setup\Scripts\setupcomplete.cmd
    set "\=<# this optional feature requires script to be [Run as administrator] #> $null=fltmc; if($LASTEXITCODE -gt 0) {return}"
    set "\=%\%; $f='Name=''MediaCreationTool%V%.exe'''; if (($null -eq $MCT) -or -not (Test-Path '..\$OEM$')) {return}"
    set "\=%\%; $sources=$env:SystemDrive+'\$Windows.~WS\Sources\Windows\sources\'; $setup=$sources+'setupprep.exe'"
    set "\=%\%; for (;;) {sleep 20; if(Test-Path $setup){break} ; if((gwmi -Class Win32_Process -Filter $f).ProcessId -le 0){break}}"
    set "\=%\%; if (Test-Path $setup) {xcopy /CYBERHIQ '..\$OEM$' ([char]34 + $sources + '$OEM$' + [char]34)} ; exit 0"

    :: finally launch MCT executable with local configuration and optional launch parameters
    powershell -win 1 -nop -c "$MCT=start MediaCreationTool%V%.exe -args $env:OPTIONS -passthru; %@1%; %@2%; %@3%; %@4%" 2>nul
    powershell -win 1 -nop -c "$MCT=start MediaCreationTool%V%.exe -args $env:OPTIONS -passthru; %\%" 2>nul

    exit/b DONE! AveYo: can skip some or all entries below if not interested in updating the esd links in products.xml
    exit || DONE! AveYo: can skip some or all entries below if not interested in updating the esd links in products.xml

    :: Insert business esd links in 1511,1607,1703; UPDATE 1909 and 2004 by hand until getting a products.xml url from microsoft
    :: Following are condensed ver,edition,lang,sizes,hashes,dirs to be recomposed into full official ESD links for MCT
  24. AveYo revised this gist Nov 14, 2020. 3 changed files with 708 additions and 580 deletions.
    3 changes: 2 additions & 1 deletion .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,5 @@
    2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
    2020.10.30: hotfix utf-8, enterprise on 1909+
    2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
    ```
    2020.11.14: generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
    ```
    1,037 changes: 458 additions & 579 deletions MediaCreationTool.bat
    458 additions, 579 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,248 @@
    ::#,1607,edN,bg-bg,2779059020,2111252165,7a3b8f8df4d678a1e7a34e341fc7d5618ec9a246,66cc95cd28f00e40caee6bec7d5d70a8fb5e773f,c,c
    ::#,1607,edN,cs-cz,2776622382,2110545610,ccf1326afdb7d2641360f79e096e49c6a38ffa32,f1a9bd1559dc919bc370f4166ef8ad86f10d73b6,c,c
    ::#,1607,edN,da-dk,2798017588,2144210086,7406eda1d78d6f3a7e8a1bb6370daeff8a28821c,497b443d71e65f6a63f01fb7ec61c53b8bfbdb6d,c,c
    ::#,1607,edN,de-de,2887254906,2219606526,64b3d9d55cbda469d5228ccc9156cd0fc23e04d4,9213ab89e0c17890d3a9151fc79932a587f3ac52,d,d
    ::#,1607,edN,el-gr,2797909794,2124151984,6d69df40a7294e47c4e1ed4dd97407df71e3b579,94e7d1affe714552cd0d5dbacbd49eb48f3f1fbc,d,d
    ::#,1607,edN,en-gb,2856936794,2200062104,1178f5a038534a6db054c0587795827c8174a3b7,3eb8ee29ddf22f0347e51c2dc0b6e244c988c9e8,d,d
    ::#,1607,edN,en-us,2861204596,2200128810,9f9054a5831a86799435742b96589d35556e0b33,3245de6b32dac4fe753a29d77c4d5276f752a9cb,c,c
    ::#,1607,edN,es-es,2851148850,2196419238,9ce4a7149f1c83547a093c77e3a054be2facd930,4ed9dcd6d9402c53b7c0d7ddadf29732ccd47ef3,d,d
    ::#,1607,edN,et-ee,2747120942,2096054254,1ed1164e84604f09732a9837adbcd27b45742d16,1edea61b5c9f927bb86adc4eb4b64e65f565f5ed,d,d
    ::#,1607,edN,fi-fi,2798444234,2136693992,9798bf4f02717618f71ab3ec9919e4c304b24ea8,8299144245d06af58bfb1787897e2601a4346bd7,d,d
    ::#,1607,edN,fr-fr,2851527218,2198063086,b80067fe56f542be1e2262fd1f93ed9bf45de7e6,d67758e1aab4ba26e563c94c9e71f02bc8b457ce,d,d
    ::#,1607,edN,hr-hr,2768580546,2099953642,35d1a05b4f329e42e0d16930b6cde4122c40f765,d9037e29d6981d000643004ac770e5e1eccfcfb7,c,c
    ::#,1607,edN,hu-hu,2782140028,2116985906,1a108c29a93bc32e4a1fd28c73e99ca88c5fc1c0,f45cf9ff9c019ecaa9b9de14252aa950bdfeed91,d,d
    ::#,1607,edN,it-it,2811926886,2145186280,7521153898da230759cbc5a3b7b6534d3a378ef0,e12aaf53fb3b43731394a90b052d522e53d4c3c8,d,d
    ::#,1607,edN,lt-lt,2757803852,2095722632,f0385e16fa913fa76719383e850d1d35070a92a8,e5d410dee7dc702f1951f7a7a8a86590f605b302,d,d
    ::#,1607,edN,lv-lv,2756086022,2095036762,7792ef1b2b8bc3c5b8c217d0748da5b8a23eea07,e41ce56ea65c5a80aae7aae51409c8353c89de3d,d,d
    ::#,1607,edN,nb-no,2773327388,2113411140,ff125d34aecdf49b9d1540d6061cab57dc7e39a3,d0fb7c0f30e00ed68322a56f83502a84ca512b7e,c,c
    ::#,1607,edN,nl-nl,2777477440,2122186926,e4d76ea47cccc8d3c917d5d86325903a9759e1f4,a71e61b4fb3a53e6346cdfae4d0a509b2c59b712,d,d
    ::#,1607,edN,pl-pl,2781418062,2121400542,b15363bc8841f93b28d285220a9ad7786e1ca9a1,e03523eb6a1426ac02da0db90e90da9ce24f242f,c,c
    ::#,1607,edN,pt-pt,2792216100,2129997546,b7810c3c8ca4c1be162ea5cacb8eecf5f90161c8,af38dc63a255f96722417a390bb29625bd5f2c0d,d,d
    ::#,1607,edN,ro-ro,2764183386,2098687326,cabebb3cdc5c3e11f839942ce96f76ebc24f14a0,7fde1bd5b650f7bd1b39da2c27a6cfce05cb58f2,d,d
    ::#,1607,edN,sk-sk,2757427958,2096928490,3abdf61dec10498ecd12df2570bffe4d11109e3b,f77f86e70b997ef156cdafa5e3927c24d020751f,d,d
    ::#,1607,edN,sl-si,2758340722,2096845220,e5b73905ef2020efc1bc646abe87a3ddd7dd7bf6,c1319abf345baf4c95a35dfbedcc0e3b9c206a59,d,d
    ::#,1607,edN,sv-se,2788498688,2130648134,fd2fcdd512f2b38c3791426b3f8421b1041a9e0f,19d90b982ec2d963667561718642d3dcf2497cd4,d,d
    ::#,1607,edu,ar-sa,2956949156,2254502852,ad209ddde42bb7c0dbe62aeaa56c9edb1e21374d,d7e56ec015c48a9ad24671c6ef1d80daea27f189,d,d
    ::#,1607,edu,bg-bg,2913342796,2227290394,d5c152271d498675f400eb335c7f20c8f05cff0d,225b91d09bd7a639fdabe14b7a82bfbb7abf5ba9,c,c
    ::#,1607,edu,cs-cz,2917449894,2213609352,abb6ab1ab0b5a9f9c715d1cf91aa473e410eb958,dbde988b353a76740e0576b53005cbd5861ef1c7,d,d
    ::#,1607,edu,da-dk,2945166370,2249489774,4641e22dd93423212b5b465db1c4b720921ff737,2a892143d6eaa1dcadc8720eb890a1db7a03b28d,d,d
    ::#,1607,edu,de-de,3018157658,2319600702,352e4a7510e0ceaf1d97f03db3579af3e0344938,a691d8569c4dd10f4831d8ab9c9bd87d7b3b918e,c,c
    ::#,1607,edu,el-gr,2934720002,2226151718,93eadcdc4ea4b3c9464de64898fc172284ba3d24,6c7b921c6798ff2a8128bcd6130962f923064642,c,c
    ::#,1607,edu,en-gb,3001730482,2303122652,d363257e8203c0b46c98bfbaeac8e50d6d762f91,6542537ae4a5b1d76c2f7658b91ccfdc84005dfe,d,d
    ::#,1607,edu,en-us,3014778678,2305264922,01e49055b446024d37bdd3ad1711a8b529bc98df,fe55e8afdcc571f8e8fd5a42cfccf14790d89cbc,c,c
    ::#,1607,edu,es-es,2999917512,2297447302,8b396b404a5e68b22570bd9d2c7bc23e0cc2fa89,6aaf073db8890a7c6aa6214633bb345cbe9a82cf,d,d
    ::#,1607,edu,es-mx,2940854936,2245392276,b16befdf9f8905fed73836a03a1505968b2aa583,79d8fa9f21f4f689ff2315d669e584058c407b69,c,c
    ::#,1607,edu,et-ee,2890533510,2190464570,6edcaa2167c569b5e3dac218f90161f686eb4ea0,7b4c97f368a2673f751a9e1c98a79a65ec846b74,c,c
    ::#,1607,edu,fi-fi,2936951164,2232027472,88e07bcb494c2973a37eb32c11c6b2f6f313d6cf,44c3d9b0f171337f3e83cd4b16b9fb04875b47c5,d,d
    ::#,1607,edu,fr-ca,2972513666,2268537776,99dff3ff2faac319c38b67adbbf7df11b996e2f0,01a686ce606798e63eee51111ba600f832cb867a,d,d
    ::#,1607,edu,fr-fr,2993414936,2298742674,c4aa11238240f052fc155a69add5aaee5a8fa2c1,e9e686f6bb0e5a2bb463969aee1ea0bec3cafa16,d,d
    ::#,1607,edu,he-il,2919856152,2225234406,ccd6fcf5bba100f8bd7416b8368ae88986d42719,135c9d913514fb9ce8c0e3a11365c1f7ec96f7d4,c,c
    ::#,1607,edu,hr-hr,2893579680,2203786466,373e5f74e3bf90e1e40597b2907a705cf7947ab6,a97c9fd5d866cb6b49f5224c0e227923335b071b,d,d
    ::#,1607,edu,hu-hu,2914578404,2219026456,9c2f593daf664ef8b2424c9b85ec981d957b96b2,24e79499a39c3f658a4721f0e64fc99f80eb71e5,c,c
    ::#,1607,edu,it-it,2966090488,2247919526,be99f0766321e460a071d50083a758dfacc64923,907c1dba70eca9011e7a4c087b76edd7d4ead76f,d,d
    ::#,1607,edu,ja-jp,3061128986,2356394260,02e4b9da921626da3d03c0a413ae76148dc0f9cc,6511fc807e5213138c36abe22ca4b9e7c9e43dfd,d,d
    ::#,1607,edu,ko-kr,2966153026,2259563116,77018ee745ebdc581693dcaa9ec8697b5605dd3b,9e869188c0d903fd0d982f93076960383d6b608e,c,c
    ::#,1607,edu,lt-lt,2886584406,2195909696,afacc60cf3c558d94d01691f896a303cd3455651,593f59fabf626765463001023aff98a29c98e713,c,c
    ::#,1607,edu,lv-lv,2884763892,2194102206,f36bada74914782fe174d92bf82222e7d5d61488,d520a5c393fd148b7e0af4fafca9e7381b5981f7,c,c
    ::#,1607,edu,nb-no,2918231688,2217842192,330597e50d041b5f9e1798671aa0857ff9dc2e3a,98468450afb526f4f16f5c791ecad934f1ad99ce,c,c
    ::#,1607,edu,nl-nl,2929881030,2227957810,5fd638867eae87b871fa1d0e393866698eda8514,1b68236863ec2782377eb23c4897fc371e5d082f,d,d
    ::#,1607,edu,pl-pl,2930550878,2226921692,3e48dfc45ec6551ba7b67ae6c965351e5b0c6263,d2e0f7a4d26c8f52d136d7bdae162075edf70757,c,c
    ::#,1607,edu,pt-br,2952864672,2254176436,5e453b92f20a8713b7ca6ecc5c2f2577cc67b58a,34066ad64f0066280ebde3b7833f89c7e468212b,c,c
    ::#,1607,edu,pt-pt,2928144706,2228686892,6135ad949cdfc76b4ebd0375f83ffd49ea09d80c,fe0f33f8faeffba3c3a059660802d9c44936c801,d,d
    ::#,1607,edu,ro-ro,2904204054,2203396506,1d231962d9263ea94c7a094565cae9e22f95e645,3787c9449e922cff784347f436f0e10b11c83588,c,c
    ::#,1607,edu,ru-ru,2957672236,2261036400,c5496123d5f1ed75a8511ea6c71c958bc38915c8,e01b56432419748e3420926222512f8b464509ca,c,c
    ::#,1607,edu,sk-sk,2893555152,2197058184,07e05be074dc12e411b3d1c5cd144a210b70e869,703136264909e5333044aec874ad6fb14790eedb,d,d
    ::#,1607,edu,sl-si,2884411810,2195839708,6236323d5ddce9c6d1e5673c13ad2232d8d8f1a3,a92efb6ebe2225fffca570d46b9bde4dcba732f9,d,d
    ::#,1607,edu,sr-rs,2891648167,2201558184,534d4a85ae9a935f7ede65e352252ad27e90f21f,8d504ce35fb48d0e43e4b0129f80157991f93727,c,c
    ::#,1607,edu,sv-se,2942914320,2230458544,67ee08ce7dcdb02cb063a40129afae15a5e7e774,5b7f3a60a484b8ab7ea57629974a6df187bdae48,c,c
    ::#,1607,edu,th-th,2909426878,2216567444,c341908be3ecdbe7150a763b900cca194befe662,df73d20b5559e717b965b762741795630a253877,c,c
    ::#,1607,edu,tr-tr,2917813760,2215387172,3cef4a469646dd673562a2990c6fc99c1d57af3d,e53d36d75762b89914ee1787e220ac10dfb5c5f8,c,c
    ::#,1607,edu,uk-ua,2913314734,2220722110,e7e3090d392bc59e15da7a49be08772a15d5c2c7,b70d87de530267e650ae34b5b29b5a316d69cde6,c,c
    ::#,1607,edu,zh-cn,3137548350,2421638284,120476969142efd3701de14d140be47cf84d92ab,32e7d27d988f97b5b77e2a371035c9b80ee23b48,d,d
    ::#,1607,edu,zh-tw,3058815872,2359003730,57c2708dc6583a3ba6005e04934bc07541626da2,2237f1fb22a928df1615afffacf3bd916a188728,c,c
    ::#,1607,prN,bg-bg,2773968628,2111630422,fc329f5b4f683d6c9dce6da8ab12254f4aee79a2,ef1cdac011e2796516bb2ecd489f5a95807db56e,c,c
    ::#,1607,prN,cs-cz,2773293502,2111595264,c8c121aa245eebedef4142d86e8c444c82eb5ebf,c2fb76d2890cd7b33759d070bd4fa9daed67839d,c,c
    ::#,1607,prN,da-dk,2797523030,2137463158,01fa575f4e02f6d7b63cf02f691cdad8b7d06385,6f3a269b3f46310845cc4671753f9bb5e0c53fbc,c,c
    ::#,1607,prN,de-de,2887386902,2220146562,dceb5a8fbefd5c891523cdaf7d9ef85ba78648ca,bfe79458d02aeaffbff01df43e43af6cff1086a2,d,d
    ::#,1607,prN,el-gr,2801821428,2120864956,33997af7aa98ddf701dd77a197a01ada0083cd16,93a91f0147950b7a92f1b52206d4185d5fe2adf7,c,c
    ::#,1607,prN,en-gb,2859609418,2198424742,91815f5e30a2b75891b396c8a0b2848befaeb46b,00f726c42be7c11b5fa7761cc26f9957880d1324,d,d
    ::#,1607,prN,en-us,2859983836,2202017206,eef8273e5aff097f031d3eced6081a2ff1ce6e70,5e29955a7ce81907f0d90f61ef0c87a4d5693150,c,c
    ::#,1607,prN,es-es,2849603408,2195845498,28c0c3facdee14fca9c415baf12e852424cfe823,cd2c62a7e75b6d0afe39da402b63b1f042b2ee60,c,c
    ::#,1607,prN,et-ee,2749178492,2095309794,956dcd0e2e74458d9c530837e76e3e85c87569af,618bb7a7e6305ae5a4ad05417c1d7a6d1c240d94,c,c
    ::#,1607,prN,fi-fi,2797659170,2136318712,2bdb6ac2dbc58954f7cd24270fe3e90284e54daa,8c673bcaf88ff3675573a358be304962900a6971,c,c
    ::#,1607,prN,fr-fr,2851575648,2199089480,2911e901d843d85ff7d4d8a26df117c915739d1e,eb7fd4ca93539d05478dec8ee088184df9ad340b,c,c
    ::#,1607,prN,hr-hr,2765117444,2100765434,2bb2b9c596d7c58a152533c0f68c193dff262f7d,90a92a7b6a6ca30d4e0b609178c9aaa49c0fcc28,c,c
    ::#,1607,prN,hu-hu,2782768444,2121777568,650ca39bc961abf7798fa7877bd44bec042426a0,7407a410bf6d9573cb22b06cc98ea8467f0df658,c,c
    ::#,1607,prN,it-it,2800506190,2144659586,63287c51ff616254966ed37d52ca9300cbb12230,f4863cd0ecf5bfee974b9c423c9d864e9bfba3b9,c,c
    ::#,1607,prN,lt-lt,2754636784,2094530112,33ce1e39bcd256df8476f189e5a6a051de49cd13,e2db5267355217e8f572b6b482b5b15e0ae85121,d,d
    ::#,1607,prN,lv-lv,2755350776,2094597898,fb774f04e2f477d5060cdf15ccb67a57471a5511,a342940c936e67f0f93c433c935b868d58d8867c,d,d
    ::#,1607,prN,nb-no,2772100158,2113869760,c1a2d7a1b2a5215831439f80a716768eabea41b9,c850d7cc8aa9b5c6a1f443efb313482c9e01fa12,d,d
    ::#,1607,prN,nl-nl,2773104714,2131740526,e363e17767440f8c902e96ab193c926610ffadd6,31f1d6c1735d862d9c4a5aad54983b9ac691dc3e,c,c
    ::#,1607,prN,pl-pl,2780436314,2126498562,695623b0a4f468c1dd7c5807faf84dfc9b9356f2,947f434e5f736374f797083686d156ac31f61cc1,c,c
    ::#,1607,prN,pt-pt,2788551940,2128468318,5d54830d399eaee9d14223f9085684c5182cdab4,76f04e40fda45dccb6d056d3a3ed629f3574f0c1,c,c
    ::#,1607,prN,ro-ro,2765807026,2099203004,d98b84579055ca2114bb86390def6a06d4450e40,c399fc45669d57ea42a650cfa1ef9cff42aa6315,d,d
    ::#,1607,prN,sk-sk,2762718640,2096757828,fef5249e7b211a31db3c756f8746cc69093b8f89,24cc2caaa234990688701aa259fc99740f6cf625,d,d
    ::#,1607,prN,sl-si,2758415634,2094438534,ac0ede2cf10e95a905f4070bcf08651625d8cf6a,0bab0901bdd35b2e1bfa11db4d31aa835a79d39b,d,d
    ::#,1607,prN,sv-se,2797681810,2129967952,1ed5517d01de32c3cc1f77cdecfe4f356c0d94c8,7b3ac33040f23a1d3ca949124aae5035270f0e0f,d,d
    ::#,1607,pro,ar-sa,3017152712,2316041282,763f8d3532a4c3d95dddc0239ec6999c6c063c43,1bd076aea51f88e19c600d34d06050f78e87099e,d,d
    ::#,1607,pro,bg-bg,2968435508,2285063890,c56a9b9f6e7c37fc548686835755676ea04625d8,d9ff9494d106af25bad566591933e20f3cbb9c01,c,c
    ::#,1607,pro,cs-cz,2976799184,2275903108,4ac0dbd8eb31b90ea7b500083a1a71f9665fb677,f721cf9c925e778ab8b0014cd8727156613664a0,d,d
    ::#,1607,pro,da-dk,3009307712,2305464234,a15c3a85061a12b7cc9b366157bb9fbc30d71aba,e830209b7541756470aa21ebca191dfc6ac39561,d,d
    ::#,1607,pro,de-de,3219035316,2495166956,dea2c577e64546463080a96c4b075e924a60d412,968aaf9107ec3d486f1125a109a1ade30cae07db,c,c
    ::#,1607,pro,el-gr,2991041138,2286941358,4f9089bfd9b0815116fce8ee104a07f445ab82e3,6e029e44b04367c7f684888280b52666f999b47c,c,c
    ::#,1607,pro,en-gb,3176583254,2476842804,db057a5eac7cb0d65691e758f3949c13f26a513d,21fb6904b75427ffc9e9d3fadd3e0df9a4035598,c,c
    ::#,1607,pro,en-us,3319805853,2602533592,a67fdee4fc4b5703b4ab599a5578a2dbe2f655f2,d91e124cbe2bfbd372a936a401bd462f4773ceee,c,c
    ::#,1607,pro,es-es,3089825090,2370591066,8428460416a1effb60b2e204c40c436cef439727,b5af8299317ac3398e93a122b06c846c4e18b6a5,d,d
    ::#,1607,pro,es-mx,3021626512,2339980484,0d6d30912e3cfb6b05481a8dac29cb165d5ec531,205d7918b164275b9fc747dd05d9bf3d5d82272c,d,d
    ::#,1607,pro,et-ee,2947223572,2250794742,736038bc59a7adbd86622480076d54c916ca583e,e39b8aebf84482322316e54a8e7fc03b200d6b5e,c,c
    ::#,1607,pro,fi-fi,2988097106,2294397954,894658288a4de3bdadc3c92caafbc77d6beaf8df,5a5a127d2b9f67eb076b2bb8a8d05588ab33e41c,d,d
    ::#,1607,pro,fr-ca,3057151984,2340335032,b7af8f72ebeb77a7529a91ba82fa96b5d7c1aca5,3921cf2651b9bf40729c503f59ea39dadd67c1ca,c,c
    ::#,1607,pro,fr-fr,3151088370,2431461582,fba5faa2d2d3c656a6e2180be4aed091e179dfbf,52c657286188ae0ff2e4dcb9e19238affbebdd95,c,c
    ::#,1607,pro,he-il,2988102890,2282465040,cce395f6f1ef65da5a9514312f7988fb975c7aab,294bee60f7d248b6766c331ed6d291f23cab54f3,d,d
    ::#,1607,pro,hr-hr,2964453442,2265497235,c6a879a1bde4828296073b45bee522a530fde1ce,453579e6e76c81fc72a2b78b554c8cafaa4a23b0,c,c
    ::#,1607,pro,hu-hu,2976155974,2284059150,952368f507a15afac4d0c4c42697c36794c57a28,237677d16e6f2256687a02e2c07d44042ec4a5c6,d,d
    ::#,1607,pro,it-it,3027424610,2312619924,ac52981de1ff7d7f7b8e8d2a4981130dd9b7062a,86b071f191f5193270378258c69814988df0f10f,c,c
    ::#,1607,pro,ja-jp,3249832189,2526997792,87dc289be935d27958cf49f9d97b3db6f2d69721,f7491c42d0d64688df6630378657cc2bf725e89e,c,c
    ::#,1607,pro,ko-kr,3053846230,2337854332,9f5180fb3d8792b87ee078df3b64cc1504221b0b,6639d29ba6934b13bcd5bec97a10cdaf1cdd30c7,d,d
    ::#,1607,pro,lt-lt,2959202730,2256006622,cd7650dac53a9f94e1556879d30ed5965a0703eb,1d142359840ab83fb067468cbb295845d07db385,c,c
    ::#,1607,pro,lv-lv,2967916812,2260414882,060160161b5ed79d53a3bffa7fc0014806664979,2a3033731f8b28041fbe193a3f718cc62a301e6f,c,c
    ::#,1607,pro,nb-no,2986394866,2279262560,80dcd802fde6998d7f82d9e34457d29106180150,5c5e576148999231f138597401cb14f25ea15829,c,c
    ::#,1607,pro,nl-nl,3005059082,2301425470,64a639f0066eed9c454e3e33451efde18dd6ba98,823da75e12b4688f0e08acb6efa686266c91d3fe,c,c
    ::#,1607,pro,pl-pl,2988628234,2284329308,953d0e942518a30e8e98fd1dea151926fc8944af,df3a74d6bd322219e33031e7e97c7ad7ac503bc1,d,d
    ::#,1607,pro,pt-br,3030217044,2337652576,9d925ec3a182e0c2822e37900f89bccb79c666ed,70142b3f23e729829b377ec56941cfa41c723204,c,c
    ::#,1607,pro,pt-pt,3007507556,2293680178,5cd6a59fe21427feee2a34f825f8783752c23d5d,b8b1c20b0cc4383b54c6547f295ad8e8a7897d2e,d,d
    ::#,1607,pro,ro-ro,2955444630,2263202628,b15bf61a558013f5202cd175308979af0a95d49a,5ce741cb144a804e2281c8476f9c65f0b4a1594e,d,d
    ::#,1607,pro,ru-ru,3039587116,2331906278,f27830fe80f8a1f56c1d492d1007f63363ff69f5,517619490219771a44196bb803dcc099110d9e05,d,d
    ::#,1607,pro,sk-sk,2944655478,2258865734,ea535aa8e2d891fdbedd9cd6a7d261c91280e495,eff3680bbbd0b45f27dabf4a054606fd78b30422,c,c
    ::#,1607,pro,sl-si,2941825400,2255942595,50c210f92a64a625d320fbe704d1e2d0fe129dd1,736233c3b0da875665d9fd8abd093771352d4608,d,d
    ::#,1607,pro,sr-rs,2972572460,2264817096,235a4d11b0346a527f34e68822b0d08af5637323,2d44d42cfe870638ee5d517da54f3286790decd4,c,c
    ::#,1607,pro,sv-se,2996962528,2303368688,956f1c12d67edd9ca19cf26a9b871610c4e51758,9b7ad348af69829d1adb57d12f5315bda42f6ecd,d,d
    ::#,1607,pro,th-th,2976849192,2275252504,64529e2290a400a605093bbf7169060ac0f9bbbb,2676ce00bc5b187ca87dfbae04226471b3bc36ec,d,d
    ::#,1607,pro,tr-tr,2975807725,2276829342,65612b0b4ac01f1bb2fec7b8a161ff31b9bf7ebe,250c7ec09eaebb90681467d906ba22f5aab890c8,d,d
    ::#,1607,pro,uk-ua,2981529906,2287688882,3d2b3939b2f60afec719c89443b170c48fba83ac,47ed1f3b95a08c706e13f5b4afb5e4ae0173a56a,c,c
    ::#,1607,pro,zh-cn,3203380142,2492418640,efdd42f9baea736aebfb443922ffbd0de4b0e2b7,bf32e2b319724e7fc6765330c55888cc3eda6637,c,c
    ::#,1607,pro,zh-tw,3136948712,2437070118,ec6068642e34a049a9bf9ff79ea439722fe6bfec,e80465b8395ca5afe4a3002519d2f100514f39eb,d,d
    ::#,1703,edN,bg-bg,3062413646,2343495134,a9b6ef650c85369e3a4f3f7232fdc7749ad0bd47,76ec0c3816f8ade33ffeee9615450467af80ec7f,c,c
    ::#,1703,edN,cs-cz,3062757590,2339079508,9e43e3051c6142fe660ab4bb3c9318750cc7de93,8ad87a656634d89236a6b32418e615418d5045d1,c,c
    ::#,1703,edN,da-dk,3063187452,2359142738,aeea7197285823c6c337af2d71ce8f922ff03bbc,2dc2a60636d961a67eb9496cb621113dcb582ef8,d,d
    ::#,1703,edN,de-de,3174260636,2468099010,fb0ebc0aa2ec1df782f6d5a5f18202df98907153,f4a2ca4545ba6a8166d4c3421849b6cc1fcb35d9,c,c
    ::#,1703,edN,el-gr,3067640890,2355660782,d4185e6aa65f5679fae8ae794ca94e75ea843016,d26d6de6ed08658921e5b702920370090e8b9592,c,c
    ::#,1703,edN,en-gb,3137052746,2426880828,0d11ae99ec511df9f9e61f860737dd1fe30b4206,14a1c43e4c7d7cf5a169257307395af0ef2e879d,d,d
    ::#,1703,edN,en-us,3139755962,2430993824,d534aa4085bf14c3df828c5af83032b79cec8bf9,88743dd5e4c3b6d8ff2f6339c7a59d535f776b90,d,d
    ::#,1703,edN,es-es,3146456906,2439392666,233790bf41149c751d40811dbfa9c64f83553d8e,22593039f6029ebce3946a1a37292545b45071ae,d,d
    ::#,1703,edN,et-ee,3031709940,2317447208,643c5c146cfa48609ab76e718b08049fe371100a,cc868eb008d71ca38fc236e745cf5e27548c4bd6,d,d
    ::#,1703,edN,fi-fi,3061874646,2341874174,41898f06c71bba38c74c5c501f4eae437ec41695,b5ed3b76897eecb07038496eb78dd05b032dce97,c,c
    ::#,1703,edN,fr-fr,3132546598,2435002592,340507bd08c569ad54e992eaa20bc5b094887bab,2ed1bf3706a82495959874e91b2a3a06e0a9e7b3,c,c
    ::#,1703,edN,hr-hr,3032743718,2321673434,1af71d7b368e2f0fa31bdc415f9a59fc7d1490df,c18c5d1e09f39c547cc4e4639915f78f3161fe0b,c,c
    ::#,1703,edN,hu-hu,3055842566,2341763976,2ae5ec7d0ce1566d5f1981d2e5b0c8f19b4bd24e,55751ed59fb161d34ddc3644f3722ae15dc424aa,c,c
    ::#,1703,edN,it-it,3099583308,2384149974,ef21e54b4149b2fcd67805d966fff614ec6a23fe,0e57750ad4aecb20870e58d35c0df1f76d494ddc,d,d
    ::#,1703,edN,lt-lt,3028908668,2326483892,bb5814b37ad1c338ab6fc73446d255e4a0134ab9,5d7619d4af7279b02bce8d4fe835205ffe470ffe,d,d
    ::#,1703,edN,lv-lv,3028644192,2324302588,0ef2a40575f7cf5110609b53d454e203145132f9,6b430483aa0af8073b3a79f3ec217a71c8e394f3,c,c
    ::#,1703,edN,nb-no,3058575164,2337167608,66f8d9a1a6a8070eef3f80d00df333d9df61fc43,eb0d9b5b9a8325b13f264b14f7e7e1f6b99eb766,c,c
    ::#,1703,edN,nl-nl,3062067296,2341747004,48c9f2807b869bb00a9ba1241424a38f95612ebe,146caf1f3bebf1be99c72c759ae57d033b159da8,d,d
    ::#,1703,edN,pl-pl,3080456656,2364261192,25becb5821e972dd606bd9155740a99ae7180a1f,6533b22e8d6ccb7867d3d97a01b5cc9e49e33541,d,d
    ::#,1703,edN,pt-pt,3076125224,2357048280,fcb4cc8a9defc6f31971aa681bdd04ee735487a7,0fafeb7203697a8d61a0deea890321b3f0d89d16,c,c
    ::#,1703,edN,ro-ro,3029460788,2329099636,ec31c6800ea132e93dff86efd58a7843b05f20be,fc2cb8041993259d5472a13b561edcdcf213e54a,d,d
    ::#,1703,edN,sk-sk,3035148714,2330490226,d3f1058d8bbbc21e81f1047a75b48b4cee0630e9,07d3014138819d9681c48c5687be4bf2d75f26d4,d,d
    ::#,1703,edN,sl-si,3024798576,2321416078,e89e7e320308935f183c2b7a7e2e7cf7172511e1,f25df37d61c88d58a7d746d6ba6159db712a70f4,c,c
    ::#,1703,edN,sv-se,3061608074,2340666742,0c40567e9a5e8d720ed6edf05a0cde9a17bb0415,ae6dd7d66db41d7683af5157459bec97824535a3,d,d
    ::#,1703,edu,ar-sa,3251847572,2492824508,75bf847f81faae21d85ce27bc2ea5081df25cdfc,4cf10443f278587cb72900324884908d8441c407,c,c
    ::#,1703,edu,bg-bg,3206626386,2449636070,c6ead57dcc61d87f3c43b78526fdbbe78d912377,f48b253b765dff39881651030268c09392de1555,c,c
    ::#,1703,edu,cs-cz,3207310586,2447727068,031224c662881365f2a971dfe42ea342c9448796,3e56ca36104feac70f46cf7ea0a8853b1b500b3d,d,d
    ::#,1703,edu,da-dk,3226462806,2467425384,60aba504f24ddbb177c94edf837ca85c21662fe0,ef137301727174a08df1fb84743469139bc4e925,d,d
    ::#,1703,edu,de-de,3327083894,2576555370,fad7f186a2e646d16a6a6b56f11b01ee0cc14f1f,d1f9c856dee75466ecd396f027aabaf640fc2122,d,d
    ::#,1703,edu,el-gr,3226390944,2467105860,c51af64f28ae99c28a3f453365195ded29aeeb2e,535d32d74692fba745c4f3241549b949d76e5d68,c,c
    ::#,1703,edu,en-gb,3282224232,2540526024,d2fd393536a0910ce1d69eb94dba465e24a545fe,0673fd68d4acd8c079a35a2213b06b318e05ff07,d,d
    ::#,1703,edu,en-us,3283493420,2541035512,5fcec6f04b988820c7a7c9324e1d8a78e897efd2,6e18fed58e3ca6097828e0b85cb9d71a6e812b47,d,d
    ::#,1703,edu,es-es,3293989448,2546176642,c2cf0c41654a9f36b7788210ccc07b98d353b63a,0d30a4ee2fff7affecb4bdff17eb67e9bc935a7f,d,d
    ::#,1703,edu,es-mx,3255353974,2493052572,9f9d726cd46235d4ec471c8ade9a0144a01512e2,5024e49e1c0ab3b0d7db5405dc1a835c5e82529e,d,d
    ::#,1703,edu,et-ee,3173983282,2429343544,8bc1d88e96a8b5563bc153cc3fd2ec1e558eeb70,20605729c6933a0d6e4dc02a03df3d404c9923ed,c,c
    ::#,1703,edu,fi-fi,3211676114,2443850910,9d0403b9310263edb3fa8e4926c033288d5d77dd,152a5599fdde049965f043ef4cd3594f725177a0,c,c
    ::#,1703,edu,fr-ca,3267937290,2520135272,1afa5bfa09a0bfa82187f93ebeb72327c8babb75,b9eef07b0f4c8d398b452a02e400e2004e1060ee,c,c
    ::#,1703,edu,fr-fr,3280449890,2541782742,c13e3a943e43a78b77954fd490ca9fddd613e36b,6d2c95ab1708554903effed98043384c07009ce1,d,d
    ::#,1703,edu,he-il,3211561870,2457389036,35fcaf72f58e39dfef29d1bc2ef909e18e4e3e8e,ccaa33207aed1be2676b952e216b70c27b0d44bd,d,d
    ::#,1703,edu,hr-hr,3187910322,2432051490,371dc050f05b667eb0ddd07f4628a6e2f6d8bbd8,d47d0ef940827000c610141a20244be8db49e093,d,d
    ::#,1703,edu,hu-hu,3198669702,2443321470,4dff1276e483c996460413fde34f4ddb2d82ec2b,3f21594fcd99429f43a134b2ad705a39a6e93a23,c,c
    ::#,1703,edu,it-it,3252699004,2499266318,1281c83d18b4a3f896b12d503fb8c04e574b579c,2cdf05c94907e814f86875c69a33fdb3f4afa56f,d,d
    ::#,1703,edu,ja-jp,3380955790,2619755766,5d61c365a23b3b1af2e52064b8d9403225f98d38,4c232d7187a7deae3b7a442becf86e83aa92585b,c,c
    ::#,1703,edu,ko-kr,3263151432,2510631222,72ec8182516a922a2790559421e3dd7a12076588,60598d7cb17d96b714e8c1e46331e8477ddfde26,d,d
    ::#,1703,edu,lt-lt,3171495573,2428993596,91811ee67098cfc971e0beca22b204f61638cfab,cdeeab36d55a0697a857988ba3539b5889a0b667,c,c
    ::#,1703,edu,lv-lv,3170436086,2428345960,17663ddefe2473ed47e1ab3021aecb49a2911957,621cb2345a0bb589f11aff848467e52a64b4aa5c,c,c
    ::#,1703,edu,nb-no,3205527402,2445596626,36959196b44da127aea969a96024af7e09de1032,a58a554d48058666f6ed04f656e7679cfeb69532,c,c
    ::#,1703,edu,nl-nl,3209719614,2451085940,4f802d5a36d6d129446419d00faf96c60f574ba3,cb9d8986c2d5d3a5845aac14e311133228184854,d,d
    ::#,1703,edu,pl-pl,3228161764,2472848030,169ea673afe3d895dde85efbee23ddce221f44f6,454e63ac6d99ea6627d7841bc0410875b5ebcc6e,c,c
    ::#,1703,edu,pt-br,3242537098,2503136758,9c8ee58f9ecc4c5748166e10788b7aef771491ad,2425c7a1c1d5f265c67fa7c06b5ce4459b305214,c,c
    ::#,1703,edu,pt-pt,3229372742,2470097536,c02515d94fbd41341f59025a2c89ebf87dabfd29,84fe29af7992ee44492f232c4be3682d03c86ca8,d,d
    ::#,1703,edu,ro-ro,3185051694,2433381486,0407c402d5a3c1c83d4b8a30cfb01747f72385e4,a197a2dae04fb628ef7d26afa7fb916168425a5b,d,d
    ::#,1703,edu,ru-ru,3247965106,2499430086,0a35728822997a3290ced87d63dd0da3f20435fa,71d32106405319b240dcf070f7685b3d1832e77e,d,d
    ::#,1703,edu,sk-sk,3193305246,2433557044,5fd6a7c13e5ad9dd90df492087ec24d814958abc,9cc504744b4aa015b221185332454ef7b16ab7be,c,c
    ::#,1703,edu,sl-si,3180336710,2429463296,dd4fc454cf52c17cc1d3c65cadad865ec39cf331,f8bed0bf249db18ef548358975e522cd5058ce80,d,d
    ::#,1703,edu,sr-rs,3186224050,2430903936,1b5296f5a5974bf00111a4e566ef945c831ad420,cee1f8554f96a20ab6f2cafbf97ec64fc8ab0cb0,d,d
    ::#,1703,edu,sv-se,3201626294,2445395424,95250cfc844f35e2882f32671ae1de8c976c4fe5,bdb42eeac01c6f273523b5acf72eef383a0c74b4,c,c
    ::#,1703,edu,th-th,3201916226,2446891086,ba005f9b74ee05f93746bce839dc877360e28922,8d24243de4efadbae4ad505b7d3ac9a911215675,d,d
    ::#,1703,edu,tr-tr,3204014662,2445522614,257208062c06e87b315007769087170d277d4a69,419b90478352a0ffb34a4acda6ad65b8c3007a44,d,d
    ::#,1703,edu,uk-ua,3206768732,2451238526,b843e99042a296e35f0821816a2ad619a5395c3d,92d482a317102c5c9c0d82c633dc2224a2e9d27a,d,d
    ::#,1703,edu,zh-cn,3448766646,2692947978,2a825c67608ded61192a63bec775096213aa5205,1c5b9c6233824e29683eab03a330597043be909d,c,c
    ::#,1703,edu,zh-tw,3384825764,2620904612,0ac1ba13c4ec709fd6edfacd6584adcefa626aee,6d88e81c026f66d3873622cd852f59b511031388,c,c
    ::#,1703,prN,bg-bg,3062965392,2342230796,5f44e18a89a33ee13c3f58956e2875c4a69e4339,784397435172346058dcddaaf598f50c1106052c,c,c
    ::#,1703,prN,cs-cz,3061390492,2340828822,eab2c98d358e19006bc5501eb376eb78c5f61ff4,f7d6e4300851b880570a4b42c290ea43a51e825a,c,c
    ::#,1703,prN,da-dk,3071035468,2357616126,b16e9860d40df7b56e1dd6ac5c66d3695ca605ac,1705dd7e86d7afcf517c549a94e2db7a445b595f,d,d
    ::#,1703,prN,de-de,3174390478,2468947694,b4f3bf648271229e67c02d4a9c3e928f59671182,3d1516229572cd93b7aa643c5afbd38f6208e9f6,d,d
    ::#,1703,prN,el-gr,3058180776,2358200780,ba6536791a95ddde7eb6d2092fbe4dc256263bc3,d2b7504700e688f39d66a773bae8f0e5ce34f79b,d,d
    ::#,1703,prN,en-gb,3138889370,2427693510,ebf08fbb1b8a857b5ddf615ecdb2e05576fde6fe,4de9f2360f0645a3fadfab850f9ab48762573d78,d,d
    ::#,1703,prN,en-us,3134074578,2431422208,8f08b14b8e4215d95df4aa8f6677c442f3280608,a7497ef7aff694250be967d2d10c6116a5d26523,d,d
    ::#,1703,prN,es-es,3147378694,2440408844,e980e0e4d391747c5079b9bcf8fa02f3610dadf8,a08ff7d5dfe25eb51d56341c4df866577c6e5e65,c,c
    ::#,1703,prN,et-ee,3033156374,2320456032,a5459eab69a630f6de0f5f7ed390d80da6287d1e,0a26ea09337519ba115f21b78e3f0aed0ab45b0d,c,c
    ::#,1703,prN,fi-fi,3058342604,2342355544,b41a9b486513d44ea20c0036973ce7e7e5677d2d,bab89eeb930561e0140eb12be7a06d6df16476bc,d,d
    ::#,1703,prN,fr-fr,3135241050,2432693414,7b1918b7a43b5c484f9604888dfd571eb5ef989c,1fa92c0dd81a6cac8efa741d27d6902f04f5f941,d,d
    ::#,1703,prN,hr-hr,3031238450,2327449750,83872704fe26c66dddb5588c43d0c5105f0a8e7e,0a725ce083bacfcced9022209bef12ab5dfdd58a,c,c
    ::#,1703,prN,hu-hu,3046729422,2342265870,dfe00bed39f3293acedfc60d4703b093b627c1bf,0aa88a593232240db6c89ab9bcd3d994fe047f8e,c,c
    ::#,1703,prN,it-it,3100978042,2385126888,9b988be77d94a9ceecfdd3c0aeb1a2921f3b3ab4,8d67fd32d106b0d7ab3b8375a013f681cbba1dff,c,c
    ::#,1703,prN,lt-lt,3028157126,2326102028,0712851abb0163df81f8692ffab04d6b1b19c7d5,37b27db921300461795edcaae085528735fa28aa,c,c
    ::#,1703,prN,lv-lv,3028725540,2326564272,d1678361ca61445e7e808a67548dc37292ebb2af,fcb378ef59b277223986482e8d0528608f74d4ff,d,d
    ::#,1703,prN,nb-no,3059758392,2338122848,326efdbe48d12dfbf7fb5be385d99ddf9891c464,c485cf3d979b1d3e85f249d39489c9c7ae077720,c,c
    ::#,1703,prN,nl-nl,3058822848,2342693286,834e4a5b1ee8a34ea6d7ab97d1543727ef07f066,9f9538de6a63c6eb9a510c1edf3f8dbf7c885dbf,d,d
    ::#,1703,prN,pl-pl,3078483218,2363883710,f503b82af5c2a1d7d3db92867c7ad8ea8c506e25,44d11c4f07f54617067a5c50a37f23047b260ad1,d,d
    ::#,1703,prN,pt-pt,3076144756,2357325274,105e7656ad4f9472f46a990e9af6fc6008bb0299,53e8e14cfd0703bfd4d529e4a6caac2352d117da,c,c
    ::#,1703,prN,ro-ro,3035255674,2328716638,07129c8b89771ee78d55b28fa0235eb5fbc203a3,672763eea048eabf9d2561532a051eecd3447d93,c,c
    ::#,1703,prN,sk-sk,3038980680,2329998398,96df6aaa8c80e17a364518e4407ec341654b7312,b5764a025eb14227a8d48a23fb53c9af2e0e2032,c,c
    ::#,1703,prN,sl-si,3027672078,2325483758,3e44dc84aef2463ed56352740a0b170651acda74,3de28a415bf6d3424387b91e5e8d54219785fa7f,c,c
    ::#,1703,prN,sv-se,3055257762,2341328688,451e5df2b8a32f7bfd04ed1b20737a16b0a3d770,d226b50b2dd9f995d4080b98030bbabcdafe76d6,c,c
    ::#,1703,pro,ar-sa,3269139960,2494401210,3963c262ac8d2b8054df782a94354ffbd234f52d,9576073ffabf77db7d51f90a37aa2df01f3fabd0,c,c
    ::#,1703,pro,bg-bg,3229523040,2450825844,d9868eb90a2d6a89244a402adfcb3fefc5a2e0e0,dba3940d5ad6dc45140bb6994d20aa527766cea6,c,c
    ::#,1703,pro,cs-cz,3225207160,2450450424,b2c8da4d2f96e81a1dfa20a38e318ef604d27587,50c30eb573ec91cfcca178745775d38f7b986b78,d,d
    ::#,1703,pro,da-dk,3242370264,2468847300,8bf3e4027b0ee612a32bfb0821e9f4424030c71c,c9a3e82cf520a3814454c24c35a4c06919ed1652,d,d
    ::#,1703,pro,de-de,3349142306,2569095198,3f35923a27d57e6b531a926824d68d70ca201e23,4e203ac80f25a6a21727dc915d80074bc5877954,c,c
    ::#,1703,pro,el-gr,3246934952,2468868678,fc990c37e360b0b3242ae7b4989fd3bcc457635b,dd90f8a993016a0847101c8e2eb1b059177860ea,c,c
    ::#,1703,pro,en-gb,3312166688,2540699908,7e7b2b9d0c229a5083fd45a7d17e77bcdabf8e69,b611bd4eb7e100596062445444a90b37d32a1540,d,d
    ::#,1703,pro,en-us,3306899294,2541865106,4ec0294c4ece0c7d977c7de1fac74f5a43412c37,5af2b28a2edeee03d47c17668797c8795cf56d2e,d,d
    ::#,1703,pro,es-es,3318862104,2546579330,d62f6693f86651315289ec6c2a36951e330053a4,7ee3ab0dc272ae71ad9638e64f734bc733e20a51,c,c
    ::#,1703,pro,es-mx,3266281600,2495688050,5732b1f2c9716012a0a5e8262f380a903b857612,ed1de56ac8f100eb7ceed68da3787004434d0c6d,c,c
    ::#,1703,pro,et-ee,3199845540,2429532836,4d4653f610d9ac20bd32aa4860a055c8ee4724d7,c067ab95f0417dfe757f673f48cf77606ced0e99,c,c
    ::#,1703,pro,fi-fi,3224291788,2455923358,a9ce6b78c9dfd83bea9a93f9693dca3db27ea3f0,5145376a20a27f09b990b8442c062f91139f4b59,d,d
    ::#,1703,pro,fr-ca,3288230206,2521110928,48d917594ec3ee11df4ecb89a28d67d5621d34b1,0d84ca5ed316ab3dddc76ecb624bad5c758e5adc,d,d
    ::#,1703,pro,fr-fr,3306810834,2542532614,fcdef8db06ed83cefc4a9764edf9e300c8a834e0,51175bc8447a6bf82b742c2bedb2513ce3c26772,c,c
    ::#,1703,pro,he-il,3232992066,2457645752,352cb000c67fdb818f2b6055354a167d4cd0a69d,35d3f60ebe22ba28fe51522a71d70269944a8789,d,d
    ::#,1703,pro,hr-hr,3211331764,2433167276,f939dc75371ec69876c572d491498aaa4a0bea72,a1c6c6d83e61563a5b094e59f9591d4a48430236,d,d
    ::#,1703,pro,hu-hu,3221998158,2443048982,ab6424a97b162cc189a3ee111f230b9b5decefc0,4d5d740d8b644610fdfc403f09c75e471dc48fa1,d,d
    ::#,1703,pro,it-it,3271830856,2500671908,b14fbaaa8ac55b6036fa2749bdb10d9eddfca97a,cedc39f6ae98c61ac0647b4a067040b1a244c913,d,d
    ::#,1703,pro,ja-jp,3399536718,2623127146,4cc008c93ceb0b76392a1c012c76ee14fcbee660,5f3a233a97b3a824de588902db59175274e7c6fe,c,c
    ::#,1703,pro,ko-kr,3286198386,2511427192,b6399dbba1a2852805086b4581d4b202dabd0d2f,b5908819eca098113bc9ef3f763a1b75aad14b84,c,c
    ::#,1703,pro,lt-lt,3205686580,2429889618,8a7beb73b01dd32141ad119a09a8bc01ebec01da,09c68f4e38d2b94671012239cf29867671999271,c,c
    ::#,1703,pro,lv-lv,3203530768,2428535640,26425a6a8d0f6aa9a05782977b692e190f7b3fe1,71d5489b02a14a1ff7eca965ceb9833f19627447,d,d
    ::#,1703,pro,nb-no,3227302824,2441045070,cf80da8119dff6edd83fc14d04f1c07a93154522,070a95e2239444b095e94bb42d1d9da70f13283b,d,d
    ::#,1703,pro,nl-nl,3231406962,2453422694,dbce7a99d33758f6880e3e25869f4dcf8cba168f,0149b5bcb08496f561e962adf8bf4bb4eb74dae7,c,c
    ::#,1703,pro,pl-pl,3254396898,2475957478,711e0bd9cba640f046d24c965478dc4c64b6bb56,07c08c77c8932aff2cd74aa51f25767200fb2d05,d,d
    ::#,1703,pro,pt-br,3271791946,2503293424,6a1729c45317670a371ab95a2888c8d46c246efd,b57a3631b25084d4608c1297d80d6aaae245bc1b,c,c
    ::#,1703,pro,pt-pt,3242820652,2473189542,543d6cf7ba085eb01fe476589b3f853f68e14a1f,04c8f1dbe58217d0e9ec83570dc205002d2fbf62,d,d
    ::#,1703,pro,ro-ro,3212920292,2433641874,7043ae390b72561e8575213280c65932fcd57bf8,6f3b6a6d0129fc638f0183fa02e9c06a46efbf69,d,d
    ::#,1703,pro,ru-ru,3277964848,2499856318,5c82a5b3d47e369e08950d1bf990d66af71382ee,b7ce8535a9d98b725decd942e0d3be30754a0575,c,c
    ::#,1703,pro,sk-sk,3209614406,2434620244,2be1c1c86924229c575ea86256ea6ceafa9250c5,1a19d541a7d730b039e8df7dd7398bfcf4830291,d,d
    ::#,1703,pro,sl-si,3193801558,2429892232,a76a6a9aba283de1d5a2c13e25f2d6f46b7b7328,0e50d975b2fe90a58aecc3c7cc201457f435c025,c,c
    ::#,1703,pro,sr-rs,3205347802,2432319216,35e53089ec427c155f267988176a98a9ba6729c1,00596ed8b28cfdc923415ce6331866b81d91033f,c,c
    ::#,1703,pro,sv-se,3238580990,2445959076,73a9dc803eadeb9026e7e431cb244af6bfe7c0b4,74da5ba69fe1e6910f3cc9a085a794f12e22ef58,d,d
    ::#,1703,pro,th-th,3233561098,2450007156,edc54e4750f7716be213f9b18e65b4eb492be1f0,67f63c4d073486cd33353f450883d921dde35945,d,d
    ::#,1703,pro,tr-tr,3218876806,2448261418,f800b571c0045b463801a504a7025816ff741d6c,b6a86891756286e3ba6b1ebd4d47e59c0c1cf5c1,d,d
    ::#,1703,pro,uk-ua,3230917596,2453351344,867689f02d837ec57b73cd705ad7bf8c70c7ddd5,4f4683215f0b795a943992677e989e4977016227,c,c
    ::#,1703,pro,zh-cn,3462073854,2693248436,63be8d0a2fb3ede0f5336ab238c871a10a2a3515,a09759e7eba5eb47e1714ef9fb90fbb9b8b16926,c,c
    ::#,1703,pro,zh-tw,3405611514,2622868522,450f612a2ef4eb388806e0e71456a45f3ff86702,b04b61789de4357e5b558e3304d251be84717905,c,c
  25. AveYo revised this gist Nov 1, 2020. 2 changed files with 6 additions and 6 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,5 @@
    2020.05.28: 2004 19041.264 first release
    2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
    2020.10.30: hotfix utf-8, enterprise on 1909+
    2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
    ```
    11 changes: 5 additions & 6 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.10.30
    :: - script refactoring, clearer edition labels, new default options, ui facelift; hotfix utf-8, enterprise on 1909+
    :: Changelog: 2020.11.01
    :: - script refactoring, clearer edition labels, new default options, hotfix utf-8, enterprise 1909+, fixed OPTIONS
    :: - 2009: 19042.572 / 2004: 19041.508 / 1909: 18363.592 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 (19H1), 1909 (19H2), 2004 (20H1), 2009 (20H2)
    @@ -163,10 +163,9 @@ goto process
    for /f "tokens=1,2 delims=." %%m in ("%B%") do set build=%%m.%%n
    %<%:f9 " Windows 10 Version "%>>% & %<%:5f " %V% "%>>% & %<%:f0 " %build% "%>>% & %<%:99 ~%>%
    echo;

    :: remove unsupported options in older versions
    if %V% LSS 1703 if /i "%OPTIONS:/DiagnosticPrompt enable=%" NEQ "%OPTIONS%" set OPTIONS=%OPTIONS:/DiagnosticPrompt enable=%
    if %V% LSS 1709 if /i "%OPTIONS:/Console=%" NEQ "%OPTIONS%" set OPTIONS=%OPTIONS:/Console=%
    if %V% LSS 1703 echo %OPTIONS% | findstr /c:"/DiagnosticPrompt enable" >nul && set "OPTIONS=%OPTIONS:/DiagnosticPrompt enable=%"
    if %V% LSS 1709 echo %OPTIONS% | findstr /c:"/Console" >nul && set "OPTIONS=%OPTIONS:/Console=%"

    :: cleanup workfolders
    (del /f /q products.* & rd /s/q %systemdrive%\$Windows.~WS %systemdrive%\$WINDOWS.~BT) 2>nul
    @@ -234,7 +233,7 @@ makecab products.xml products.cab >nul
    :: handle auto upgrade scenario without user intervention when script was renamed to "auto MediaCreationTool.bat"
    set AUTO_OPTIONS=/Eula Accept /MigChoice Upgrade /Auto Upgrade /Action UpgradeNow
    for /f %%/ in ("%~n0") do if /i %%/ NEQ auto (set AUTO=) else set AUTO=1
    if defined AUTO if /i "%OPTIONS:Upgrade=%" EQU "%OPTIONS%" set OPTIONS=%OPTIONS% %AUTO_OPTIONS%
    if defined AUTO echo %OPTIONS% | findstr /c:"Upgrade" >nul && set "OPTIONS=%OPTIONS% %AUTO_OPTIONS%"

    :: import $OEM$ folder into generated media - for example $OEM$\$$\Setup\Scripts\setupcomplete.cmd gets executed once after setup
    set "OEM=%~dp0$OEM$" & set "SOURCES=%SystemDrive%\$Windows.~WS\Sources\Windows\sources\"
  26. AveYo revised this gist Oct 30, 2020. 2 changed files with 16 additions and 13 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,5 @@
    2020.02.29: 19H2 18363.592
    2020.05.28: 2004 19041.264 first release
    2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
    2020.10.30: hotfix utf-8, enterprise on 1909+
    ```
    28 changes: 15 additions & 13 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@
    :: Universal MCT wrapper script by AveYo - for all Windows 10 versions from 1507 to 20H2!
    :: Nothing but Microsoft-hosted source links and no third-party tools - script just configures a xml and starts MCT!
    :: Ingenious support for business editions (Enterprise / VL) selecting language, x86, x64 or AiO inside the MCT GUI!
    :: Changelog: 2020.10.29
    :: - script refactoring to accomodate all versions, clearer edition labels, new default options, ui facelift
    :: Changelog: 2020.10.30
    :: - script refactoring, clearer edition labels, new default options, ui facelift; hotfix utf-8, enterprise on 1909+
    :: - 2009: 19042.572 / 2004: 19041.508 / 1909: 18363.592 / 1903: 18362.356 / 1809: 17763.379 / 1803: 17134.112

    set CHOICES= 1507, 1511, 1607, 1703, 1709, 1803, 1809, 1903 (19H1), 1909 (19H2), 2004 (20H1), 2009 (20H2)
    @@ -196,33 +196,35 @@ if %V% GTR 1511 (set "XP=MCT.Catalogs.Catalog.PublishedMedia") else set "XP=Publ
    set "XN='./products.xml'"

    :: apply Catalog version for MCT compatibility
    if defined CAB powershell -nop -c "[xml]$p=gc %XN%; $p.MCT.Catalogs.Catalog.version='%C%'; $p.Save(%XN%)"
    if defined CAB powershell -nop -c "[xml]$p=gc %XN% -enc UTF8; $p.MCT.Catalogs.Catalog.version='%C%'; $p.Save(%XN%)"
    :: insert Catalog version nodes if products link was .xml, not .cab: 1507, 1511, 1703
    set "@1= [xml]$r=New-Object System.Xml.XmlDocument; $d=$r.CreateXmlDeclaration('1.0','UTF-8',$null); $null=$r.AppendChild($d)"
    set "@2= $tmp=$r; foreach($n in @('MCT','Catalogs','Catalog')){$e=$r.CreateElement($n); $null=$tmp.AppendChild($e); $tmp=$e;}"
    set "@3= $h=$r.SelectNodes('/MCT/Catalogs/Catalog')[0]; $h.SetAttribute('version','%C%')"
    set "@4= [xml]$p=gc %XN%; $null=$h.AppendChild($r.ImportNode($p.PublishedMedia,$true)); $r.Save(%XN%)"
    set "@4= [xml]$p=gc %XN% -enc UTF8; $null=$h.AppendChild($r.ImportNode($p.PublishedMedia,$true)); $r.Save(%XN%)"
    if not defined CAB if %V% GTR 1511 powershell -nop -c "%@1%; %@2%; %@3%; %@4%"

    :: apply EULA url fix to prevent MCT timing out while downloading it - specially under naked Windows 7 host (likely TLS issue)
    set "EULA=http://download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9/EULA_MCTool_"
    set "@1= foreach ($e in $p.%XP%.EULAS.EULA) {$e.URL='%EULA%'+$e.LanguageCode.ToUpper()+'_6.27.16.rtf'}"
    if %V% GTR 1507 powershell -nop -c "[xml]$p=gc %XN%; %@1%; $p.Save(%XN%)"
    if %V% GTR 1507 powershell -nop -c "[xml]$p=gc %XN% -enc UTF8; %@1%; $p.Save(%XN%)"
    :: insert EULA nodes in xml that do not include them: 1507
    set "@1= $t=[xml]('<EULAS><EULA><URL/><LanguageCode/></EULA></EULAS>'); $9=$r.AppendChild($p.ImportNode($t.EULAS,$true))"
    set "@2= foreach ($e in $r.Languages.Language){$c=$p.ImportNode($t.EULAS.EULA,$true);$lang=$e.LanguageCode;$c.LanguageCode=$lang"
    set "@3= $c.URL='%EULA%'+$lang.ToUpper()+'_6.27.16.rtf'; $null=$r.EULAS.AppendChild($c)}"
    set "@4= $d=$r.EULAS.SelectNodes('EULA') |? {($_.URL -eq '') -or ($_.LanguageCode -eq 'default')} |%% {$r.EULAS.RemoveChild($_)}"
    if not defined CAB if %V% EQU 1507 powershell -nop -c "[xml]$p=gc %XN%; $r=$p.%XP%; %@1%; %@2%; %@3%; %@4%; $p.Save(%XN%)"
    if not defined CAB if %V% EQU 1507 powershell -nop -c "[xml]$p=gc %XN% -enc UTF8; $r=$p.%XP%; %@1%;%@2%;%@3%;%@4%; $p.Save(%XN%)"

    :: unhide combined business editions in xml that include them: 1709 - 20H2; unhide Education on 1507 - 1511; add 'Consumer' label
    set "@1= if ($e.Edition -eq 'Enterprise') {$e.Edition_Loc='Windows 10 vl Enterprise | Pro | Edu'; $e.IsRetailOnly='False'}"
    :: unhide combined business editions in xml that include them: 1709 - 20H2; unhide Education on 1507 - 1511; better edition label
    set "@1= if ($e.Edition -eq 'Enterprise' -and $e.Architecture -ne 'ARM64')"
    set "@1= %@1% {$e.Edition_Loc='Windows 10 vl Enterprise | Pro | Edu'; $e.IsRetailOnly='False'}"
    if %V% EQU 1703 set "@1= if ($e.Edition -like '*Cloud*') {$e.IsRetailOnly='False'}"
    if %V% LEQ 1511 set "@1= if ($e.Edition -like '*Education*') {$e.IsRetailOnly='False'}"
    if %V% LEQ 1511 (set "CONSUMER=Home | Pro") else set "CONSUMER=Home | Pro | Edu"
    set "@2= if ($e.Edition_Loc -eq '%%CLIENT%%') {$e.Edition_Loc='Windows 10 %CONSUMER%'}"
    if %V% LEQ 1703 set "@2= %@2%; if ($e.Edition_Loc -eq '%%CLIENT_N%%') {$e.Edition_Loc='Windows 10 %CONSUMER% N'}"
    if %UNHIDE_BUSINESS%0 GEQ 1 powershell -nop -c "[xml]$p=gc %XN%; foreach ($e in $p.%XP%.Files.File) {%@1%; %@2%;}; $p.Save(%XN%)"
    set "@3= foreach ($e in $p.%XP%.Files.File) {%@1%; %@2%;}"
    if %UNHIDE_BUSINESS%0 GEQ 1 powershell -nop -c "[xml]$p=gc %XN% -enc UTF8; %@3%; $p.Save(%XN%)"
    :: insert individual business editions in xml that never included them: 1607, 1703
    if %INSERT_BUSINESS%0 GEQ 1 call :insert_business >nul 2>nul

    @@ -249,12 +251,12 @@ exit/b DONE!
    :init script
    @echo off & title %1 & color 9f & mode 120,30
    :: self-echo top 2-18 lines of script
    <"%~f0" (set/p \=&for /l %%/ in (1,1,18) do set \=& set/p \=& call echo/%%\%%)
    <"%~f0" (set/p \=&for /l %%/ in (1,1,18) do set \=& set/p \=& call echo;%%\%%)
    :: lean xp+ color macros by AveYo: %<%:af " hello "%>>% & %<%:cf " w\"or\"ld "%>% for single \ / " use .%|%\ .%|%/ \"%|%\"
    for /f "delims=:" %%\ in ('echo/prompt $h$s$h:^|cmd/d') do set "|=%%\" &set ">>=\..\c nul &set/p \=%%\%%\%%\%%\%%\%%\%%\<nul&popd"
    for /f "delims=:" %%\ in ('echo;prompt $h$s$h:^|cmd/d') do set "|=%%\" &set ">>=\..\c nul &set/p \=%%\%%\%%\%%\%%\%%\%%\<nul&popd"
    set "<=pushd "%allusersprofile%"&2>nul findstr /c:\ /a" &set ">=%>>%&echo;" &set "|=%|:~0,1%" &set/p \=\<nul>"%allusersprofile%\c"
    :: generate a latest_MCT_script.url file for manual update - could have made the script to update itself, but decided against it
    for %%s in (latest_MCT_script.url) do if not exist %%s (echo/[InternetShortcut]& echo/URL=https://pastebin.com/bBw0Avc4)>%%s
    for %%s in (latest_MCT_script.url) do if not exist %%s (echo;[InternetShortcut]&echo;URL=https://git.io/MediaCreationTool.bat)>%%s
    :: use MCT workfolder
    pushd "%~dp0" & mkdir MCT >nul 2>nul & pushd MCT
    :: (un)define main variables
    @@ -661,7 +663,7 @@ uN,x86,sv-se,d;19d90b982ec2d963667561718642d3dcf2497cd4,2130648134,d;ae6dd7d66db
    #: parameters specific to 1607 or 1703 expected via command line: $release $build $date $code
    $url = 'http://fg.ds.b1.download.windowsupdate.com/'
    $edi = @{e='Enterprise';eN='EnterpriseN';p='Professional';pN='ProfessionalN';u='Education';uN='EducationN'}
    [xml]$p = gc './products.xml'
    [xml]$p = gc './products.xml' -enc UTF8
    foreach ($e in @('e','eN','p','pN','u','uN')){
    $n = $e.Replace('e','p');
    [Object]$csve = $csv | Where-Object {$_.Edition -eq $e}
  27. AveYo revised this gist Oct 30, 2020. No changes.
  28. AveYo revised this gist Oct 30, 2020. 4 changed files with 596 additions and 952 deletions.
    4 changes: 2 additions & 2 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,6 @@
    ![Preview1](https://i.imgur.com/YfBThX8.png)
    ![Preview1](https://i.imgur.com/EEQbC2k.png)
    ![Preview2](https://i.imgur.com/wSd1DlZ.png)

    Update: adjusted script for easy splitting into a lite version (only missing generating RS1/RS2 business entries)
    ```
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
    2018.10.12: added data loss warning for RS5
    @@ -13,4 +12,5 @@ Update: adjusted script for easy splitting into a lite version (only missing gen
    2019.11.16: 19H2 18363.418 as default choice (updated hard-coded links)
    2020.02.29: 19H2 18363.592
    2020.05.28: 2004 19041.264 first release
    2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
    ```
    208 changes: 0 additions & 208 deletions MediaCreationTool lite.bat
    Original file line number Diff line number Diff line change
    @@ -1,208 +0,0 @@
    @echo off &title MediaCreationTool.bat by AveYo v2020.05.28 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    :: Changelog:
    :: - native xml patching so no editions spam: just combined client and combined business (individual business in 1607, 1703)
    :: - patching all eula links to use http as MCT can fail at downloading - specially under naked Windows 7 host / outdated TLS
    :: - generating products.xml entries for business editions in 1607 and 1703 that never had them included so far (optional)
    :: - 50KB increase in script size is well worth above feature imho but you can skip it by copy/pasting until the NOTICE marker
    :: - reinstated 1809 [RS5] with native xml patching of products.xml for MCT; added data loss warning for RS5
    :: - RS5 is officially back! And a greatly improved choices dialog - feel free to use the small snippet in your own scripts
    :: - added Auto Upgrade launch options preset with support for a setupcomplete.cmd in the current folder
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)
    :: - 2004 19041.264 first release

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"

    :: Comment to not create individual business editions in products.xml that never included them: 1607, 1703
    set "CREATE_BUSINESS=yes"

    :: Add / remove launch parameters below if needed - it is preset for least amount of issues when doing upgrades
    set OPTIONS=/Telemetry Disable /MigrateDrivers all /ResizeRecoveryPartition disable /ShowOOBE none

    :: Uncomment to force a specific Edition, Architecture and Language - if enabled, all 3 must be used
    rem set OPTIONS=%OPTIONS% /MediaEdition Enterprise /MediaArch x64 /MediaLangCode en-us

    :: Uncomment to disable dynamic update
    rem set OPTIONS=%OPTIONS% /DynamicUpdate Disable

    :: Uncomment to force Auto Upgrade - no user intervention needed
    rem set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade

    :: Uncomment to show live mct console log for debugging
    rem set "OPTIONS=%OPTIONS% /Console /DiagnosticPrompt enable /NoReboot"

    :: Uncomment to bypass gui dialog choice and hardcode the version: 1=1607,2=1703,3=1709,4=1803,5=1809,6=1903,7=1909,8=LATEST
    rem set/a MCT_VERSION=8

    :: Available MCT versions
    set versions= 1607, 1703, 1709, 1803, 1809, 1903, 1909, 2004, LATEST MCT

    :: Show dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 8 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION echo No MCT_VERSION selected, exiting.. & timeout /t 5 & exit/b
    goto version-%MCT_VERSION%

    :version-9 - LATEST MCT
    set "V="
    set "B=LATEST AVAILABLE VIA MCT"
    set "D="
    set "CAB=http://go.microsoft.com/fwlink/?LinkId=841361"
    set "MCT=http://go.microsoft.com/fwlink/?LinkId=691209"
    goto process

    :version-8
    set "V=2004"
    set "B=19041.264.200511-0456"
    set "D=_20200514"
    set "CAB=http://download.microsoft.com/download/8/6/e/86e2d7b8-59b3-442b-8306-6697fc52b2bd/products_20200514.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe"
    goto process

    :version-7
    set "V=1909"
    set "B=18363.592.200109-2016"
    set "D=_20200116"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    goto process

    :version-6
    set "V=1903"
    set "B=18362.356.190909-1636"
    set "D=_20190912"
    set "CAB=http://download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1903.exe"
    goto process

    :version-5
    set "V=1809"
    set "B=17763.379.190312-0539"
    set "D=_20190314"
    set "CAB=http://download.microsoft.com/download/8/E/8/8E852CBF-0BCC-454E-BDF5-60443569617C/products_20190314.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    goto process

    :version-4
    set "V=1803"
    set "B=17134.112.180619-1212"
    set "D=_20180705"
    set "CAB=http://download.microsoft.com/download/5/C/B/5CB83D2A-2D7E-4129-9AFE-353F8459AA8B/products_20180705.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    goto process

    :version-3
    set "V=1709"
    set "B=16299.125.171213-1220"
    set "D=_20180105"
    set "CAB=http://download.microsoft.com/download/3/2/3/323D0F94-95D2-47DE-BB83-1D4AC3331190/products_20180105.cab"
    set "MCT=http://download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    goto process

    :version-2
    set "V=1703"
    set "B=15063.0.170710-1358"
    set "D=_20170727" || note that only business editions are updated, while the consumer ones stay on 20170317
    set "CAB=http://download.microsoft.com/download/9/5/4/954415FD-D9D7-4E1F-8161-41B3A4E03D5E/products_20170317.cab"
    set "MCT=http://download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    :: 1703 MCT is also bugged so use 1607 instead
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    goto process

    :version-1
    set "V=1607"
    set "B=14393.0.161119-1705"
    set "D=_20170116"
    set "CAB=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products_20170116.cab"
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    goto process

    :process
    echo.
    echo Selected MediaCreationTool.exe for Windows 10 Version %V% Build %B%
    echo.
    echo "Windows 10" default MCT choice is usually combined consumer: Pro + Edu + Home
    echo "Windows 10 Enterprise" is usually combined business: Pro VL + Edu VL + Ent
    echo RS1 and RS2 for business only come as individual idx: Pro VL or Edu VL or Ent
    echo.
    echo If any issues, run script as Admin / check BITS service!
    echo Please wait while preparing products%D%.cab and MediaCreationTool%V%.exe ...
    echo.
    bitsadmin.exe /reset /allusers >nul 2>nul
    net stop bits /y 2>nul
    net start bits /y 2>nul

    ::if %V% EQU 1809 set "OPTIONS=%OPTIONS:Telemetry Disable=Telemetry Enable%" &rem Just in case MS screwed up again..

    :: cleanup - can include temporary files too but not recommended as you can't resume via C:\$Windows.~WS\Sources\setuphost
    pushd "%~dp0"
    del /f /q products.* 2>nul &rem rd /s/q C:\$Windows.~WS 2>nul & rd /s/q C:\$WINDOWS.~BT 2>nul
    :: download MCT
    set "DOWNLOAD=(new-object System.Net.WebClient).DownloadFile"
    if not exist MediaCreationTool%V%.exe powershell -noprofile -c "%DOWNLOAD%('%MCT%','MediaCreationTool%V%.exe');"
    if not exist MediaCreationTool%V%.exe color 0e & echo Warning! missing MediaCreationTool%V%.exe
    :: download and expand CAB
    if defined CAB if not exist products%D%.cab powershell -noprofile -c "%DOWNLOAD%('%CAB%','products%D%.cab');"
    if defined CAB if not exist products%D%.cab color 0e & echo Warning! cannot download products%D%.cab & set "CAB="
    if defined CAB if exist products%D%.cab expand.exe -R products%D%.cab -F:* . >nul 2>nul
    if defined CAB if exist products%D%.cab if not exist products.xml ren products%D%.cab products.xml
    :: download fallback XML
    if defined XML if not exist products%D%.xml powershell -noprofile -c "%DOWNLOAD%('%XML%','products%D%.xml');"
    if defined XML if not exist products%D%.xml color 0e & echo Warning! cannot download products%D%.xml & set "XML="
    if defined XML if not exist products.xml copy /y products%D%.xml products.xml >nul 2>nul
    :: got products.xml?
    if not exist products.xml color 0c & echo Error! products%D%.cab or products%D%.xml are not available atm & pause & exit /b
    :: patch catalog version
    set "p0=$p.MCT.Catalogs.Catalog.version='%CAT%';"
    if defined CAT powershell -noprofile -c "[xml]$p = Get-Content './products.xml'; %p0%; $p.Save('./products.xml')"
    :: patch fallback XML for MCT
    if not defined CAT set "CAT=1.3"
    set "p1=[xml]$r=New-Object System.Xml.XmlDocument; $d=$r.CreateXmlDeclaration('1.0','UTF-8',$null); $null=$r.AppendChild($d);"
    set "p2=$tmp=$r; foreach($n in @('MCT','Catalogs','Catalog')){ $e=$r.CreateElement($n); $null=$tmp.AppendChild($e); $tmp=$e; };"
    set "p3=$h=$r.SelectNodes('/MCT/Catalogs/Catalog')[0];$h.SetAttribute('version','%CAT%'); [xml]$p=Get-Content './products.xml';"
    set "p4=$null=$h.AppendChild($r.ImportNode($p.PublishedMedia,$true)); $r.Save('./products.xml')"
    if defined XML powershell -noprofile -c "%p1% %p2% %p3% %p4%"
    :: patch XML url for EULAs as older MCT has issues downloading them specially under naked Windows 7 host (likely TLS issue)
    set "EULA_FIX=http://download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9"
    set "p5=foreach ($e in $p.MCT.Catalogs.Catalog.PublishedMedia.EULAS.EULA){$e.URL='%EULA_FIX%/EULA'+($e.URL -split '/EULA')[1]}"
    powershell -noprofile -c "[xml]$p = Get-Content './products.xml'; %p5%; $p.Save('./products.xml')"
    :: patch XML to unhide combined business editions in products.xml that include them: 1709, 1803, 1809
    set "p6=foreach ($e in $p.MCT.Catalogs.Catalog.PublishedMedia.Files.File){ if ($e.Edition -eq 'Enterprise'){"
    set "p7= $e.IsRetailOnly = 'False'; $e.Edition_Loc = 'Windows 10 ' + $e.Edition } }"
    if "%UNHIDE_BUSINESS%"=="yes" powershell -noprofile -c "[xml]$p=Get-Content './products.xml';%p6%%p7%;$p.Save('./products.xml')"
    :: patch XML to create individual business editions in products.xml that never included them: 1607, 1703
    call :create_business >nul 2>nul
    :: repack XML into CAB
    makecab products.xml products.cab >nul
    :: finally launch MCT with local configuration and optional launch parameters
    if /i "%OPTIONS:/MigChoice Upgrade=%"=="%OPTIONS%" start "" MediaCreationTool%V%.exe /Selfhost %OPTIONS% & exit/b
    :: if Upgrade selected, wait for MCT to finish then run setupprep with parameteres directly to overcome MCT limitations
    set OPTIONS=/Selfhost %OPTIONS% /PostOOBE "%~dp0setupcomplete.cmd" & if not exist setupcomplete.cmd cd.>setupcomplete.cmd
    set "p1=MediaCreationTool%V%.exe /Selfhost %OPTIONS% /Action CreateUpgradeMedia /NoFinalize"
    set "p2=(if not exist C:\ESD\Windows\sources\setupprep.exe exit)"
    set "p3=echo start \"setup\" \"%%~dp0sources\setupprep.exe\" %OPTIONS% > C:\ESD\Windows\auto.bat"
    set "p4=start \"setup\" /min cmd.exe /c C:\ESD\Windows\auto.bat"
    powershell -c "Start-Process cmd.exe -ArgumentList '/c %p1% & %p2% & %p3% & %p4%' -WindowStyle Hidden"
    exit/b

    :choices dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    set "snippet=iex(([io.file]::ReadAllText('%~f0')-split':PS_CHOICE\:.*')[1]); Choices %*"
    (for /f "usebackq" %%s in (`powershell -noprofile -c "%snippet:"='%"`) do set "%~1=%%s") &exit/b :PS_CHOICE:
    function Choices($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc='MidnightBlue',$fc='Snow',[string]$min='400') {
    [void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $f=New-Object System.Windows.Forms.Form;
    $bt=@(); $i=1; $global:rez=''; $ch=($choices+',Cancel').split(','); $ch | foreach { $b=New-Object System.Windows.Forms.Button;
    $b.Name=$i; $b.Text=$_; $b.Font='Tahoma,'+$sz; $b.Margin='0,0,9,9'; $b.Location='9,'+($sz*3*$i-$sz); $b.MinimumSize=$min+',18';
    $b.AutoSize=1; $b.cursor='Hand'; $b.add_Click({$global:rez=$this.Name;$f.Close()}); $f.Controls.Add($b); $bt+=$b; $i++ }
    $f.Text=$caption; $f.BackColor=$bc; $f.ForeColor=$fc; $f.StartPosition=4; $f.AutoSize=1; $f.AutoSizeMode=0; $f.MaximizeBox=0;
    $f.AcceptButton=$bt[$sel-1]; $f.CancelButton=$bt[-1]; $f.Add_Shown({$f.Activate();$bt[$sel-1].focus()}); $null=$f.ShowDialog();
    if($global:rez -ne $ch.length){ return $global:rez }else{ return $null } } :PS_CHOICE:
    :: Let's Make Console Scripts Friendlier Initiative by AveYo - MIT License - call :choices rez "one, 2 two, three" 3 'Usage'

    ::==============================================================================================================================
    :NOTICE: IF INTERESTED IN BUSINESS EDITIONS FOR 1607 AND 1703 TOO, GET THE FULL SCRIPT FROM THE LINKS AT THE TOP
    ::==============================================================================================================================
    #^_^#
    1,128 changes: 594 additions & 534 deletions MediaCreationTool.bat
    594 additions, 534 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
    208 changes: 0 additions & 208 deletions MediaCreationTool_auto_upgrade.bat
    Original file line number Diff line number Diff line change
    @@ -1,208 +0,0 @@
    @echo off &title MediaCreationTool.bat by AveYo v2020.05.28 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    :: Changelog:
    :: - native xml patching so no editions spam: just combined client and combined business (individual business in 1607, 1703)
    :: - patching all eula links to use http as MCT can fail at downloading - specially under naked Windows 7 host / outdated TLS
    :: - generating products.xml entries for business editions in 1607 and 1703 that never had them included so far (optional)
    :: - 50KB increase in script size is well worth above feature imho but you can skip it by copy/pasting until the NOTICE marker
    :: - reinstated 1809 [RS5] with native xml patching of products.xml for MCT; added data loss warning for RS5
    :: - RS5 is officially back! And a greatly improved choices dialog - feel free to use the small snippet in your own scripts
    :: - added Auto Upgrade launch options preset with support for a setupcomplete.cmd in the current folder
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)
    :: - 2004 19041.264 first release

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"

    :: Comment to not create individual business editions in products.xml that never included them: 1607, 1703
    set "CREATE_BUSINESS=yes"

    :: Add / remove launch parameters below if needed - it is preset for least amount of issues when doing upgrades
    set OPTIONS=/Telemetry Disable /MigrateDrivers all /ResizeRecoveryPartition disable /ShowOOBE none

    :: Uncomment to force a specific Edition, Architecture and Language - if enabled, all 3 must be used
    rem set OPTIONS=%OPTIONS% /MediaEdition Enterprise /MediaArch x64 /MediaLangCode en-us

    :: Uncomment to disable dynamic update
    rem set OPTIONS=%OPTIONS% /DynamicUpdate Disable

    :: Uncomment to force Auto Upgrade - no user intervention needed
    set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade

    :: Uncomment to show live mct console log for debugging
    rem set "OPTIONS=%OPTIONS% /Console /DiagnosticPrompt enable /NoReboot"

    :: Uncomment to bypass gui dialog choice and hardcode the version: 1=1607,2=1703,3=1709,4=1803,5=1809,6=1903,7=1909,8=LATEST
    set/a MCT_VERSION=8

    :: Available MCT versions
    set versions= 1607, 1703, 1709, 1803, 1809, 1903, 1909, 2004, LATEST MCT

    :: Show dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 8 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION echo No MCT_VERSION selected, exiting.. & timeout /t 5 & exit/b
    goto version-%MCT_VERSION%

    :version-9 - LATEST MCT
    set "V="
    set "B=LATEST AVAILABLE VIA MCT"
    set "D="
    set "CAB=http://go.microsoft.com/fwlink/?LinkId=841361"
    set "MCT=http://go.microsoft.com/fwlink/?LinkId=691209"
    goto process

    :version-8
    set "V=2004"
    set "B=19041.264.200511-0456"
    set "D=_20200514"
    set "CAB=http://download.microsoft.com/download/8/6/e/86e2d7b8-59b3-442b-8306-6697fc52b2bd/products_20200514.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe"
    goto process

    :version-7
    set "V=1909"
    set "B=18363.592.200109-2016"
    set "D=_20200116"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    goto process

    :version-6
    set "V=1903"
    set "B=18362.356.190909-1636"
    set "D=_20190912"
    set "CAB=http://download.microsoft.com/download/4/e/4/4e491657-24c8-4b7d-a8c2-b7e4d28670db/products_20190912.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1903.exe"
    goto process

    :version-5
    set "V=1809"
    set "B=17763.379.190312-0539"
    set "D=_20190314"
    set "CAB=http://download.microsoft.com/download/8/E/8/8E852CBF-0BCC-454E-BDF5-60443569617C/products_20190314.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1809.exe"
    goto process

    :version-4
    set "V=1803"
    set "B=17134.112.180619-1212"
    set "D=_20180705"
    set "CAB=http://download.microsoft.com/download/5/C/B/5CB83D2A-2D7E-4129-9AFE-353F8459AA8B/products_20180705.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool1803.exe"
    goto process

    :version-3
    set "V=1709"
    set "B=16299.125.171213-1220"
    set "D=_20180105"
    set "CAB=http://download.microsoft.com/download/3/2/3/323D0F94-95D2-47DE-BB83-1D4AC3331190/products_20180105.cab"
    set "MCT=http://download.microsoft.com/download/A/B/E/ABEE70FE-7DE8-472A-8893-5F69947DE0B1/MediaCreationTool.exe"
    goto process

    :version-2
    set "V=1703"
    set "B=15063.0.170710-1358"
    set "D=_20170727" || note that only business editions are updated, while the consumer ones stay on 20170317
    set "CAB=http://download.microsoft.com/download/9/5/4/954415FD-D9D7-4E1F-8161-41B3A4E03D5E/products_20170317.cab"
    set "MCT=http://download.microsoft.com/download/1/C/4/1C41BC6B-F8AB-403B-B04E-C96ED6047488/MediaCreationTool.exe"
    :: 1703 MCT is also bugged so use 1607 instead
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    goto process

    :version-1
    set "V=1607"
    set "B=14393.0.161119-1705"
    set "D=_20170116"
    set "CAB=http://wscont.apps.microsoft.com/winstore/OSUpgradeNotification/MediaCreationTool/prod/Products_20170116.cab"
    set "MCT=http://download.microsoft.com/download/C/F/9/CF9862F9-3D22-4811-99E7-68CE3327DAE6/MediaCreationTool.exe"
    goto process

    :process
    echo.
    echo Selected MediaCreationTool.exe for Windows 10 Version %V% Build %B%
    echo.
    echo "Windows 10" default MCT choice is usually combined consumer: Pro + Edu + Home
    echo "Windows 10 Enterprise" is usually combined business: Pro VL + Edu VL + Ent
    echo RS1 and RS2 for business only come as individual idx: Pro VL or Edu VL or Ent
    echo.
    echo If any issues, run script as Admin / check BITS service!
    echo Please wait while preparing products%D%.cab and MediaCreationTool%V%.exe ...
    echo.
    bitsadmin.exe /reset /allusers >nul 2>nul
    net stop bits /y 2>nul
    net start bits /y 2>nul

    ::if %V% EQU 1809 set "OPTIONS=%OPTIONS:Telemetry Disable=Telemetry Enable%" &rem Just in case MS screwed up again..

    :: cleanup - can include temporary files too but not recommended as you can't resume via C:\$Windows.~WS\Sources\setuphost
    pushd "%~dp0"
    del /f /q products.* 2>nul &rem rd /s/q C:\$Windows.~WS 2>nul & rd /s/q C:\$WINDOWS.~BT 2>nul
    :: download MCT
    set "DOWNLOAD=(new-object System.Net.WebClient).DownloadFile"
    if not exist MediaCreationTool%V%.exe powershell -noprofile -c "%DOWNLOAD%('%MCT%','MediaCreationTool%V%.exe');"
    if not exist MediaCreationTool%V%.exe color 0e & echo Warning! missing MediaCreationTool%V%.exe
    :: download and expand CAB
    if defined CAB if not exist products%D%.cab powershell -noprofile -c "%DOWNLOAD%('%CAB%','products%D%.cab');"
    if defined CAB if not exist products%D%.cab color 0e & echo Warning! cannot download products%D%.cab & set "CAB="
    if defined CAB if exist products%D%.cab expand.exe -R products%D%.cab -F:* . >nul 2>nul
    if defined CAB if exist products%D%.cab if not exist products.xml ren products%D%.cab products.xml
    :: download fallback XML
    if defined XML if not exist products%D%.xml powershell -noprofile -c "%DOWNLOAD%('%XML%','products%D%.xml');"
    if defined XML if not exist products%D%.xml color 0e & echo Warning! cannot download products%D%.xml & set "XML="
    if defined XML if not exist products.xml copy /y products%D%.xml products.xml >nul 2>nul
    :: got products.xml?
    if not exist products.xml color 0c & echo Error! products%D%.cab or products%D%.xml are not available atm & pause & exit /b
    :: patch catalog version
    set "p0=$p.MCT.Catalogs.Catalog.version='%CAT%';"
    if defined CAT powershell -noprofile -c "[xml]$p = Get-Content './products.xml'; %p0%; $p.Save('./products.xml')"
    :: patch fallback XML for MCT
    if not defined CAT set "CAT=1.3"
    set "p1=[xml]$r=New-Object System.Xml.XmlDocument; $d=$r.CreateXmlDeclaration('1.0','UTF-8',$null); $null=$r.AppendChild($d);"
    set "p2=$tmp=$r; foreach($n in @('MCT','Catalogs','Catalog')){ $e=$r.CreateElement($n); $null=$tmp.AppendChild($e); $tmp=$e; };"
    set "p3=$h=$r.SelectNodes('/MCT/Catalogs/Catalog')[0];$h.SetAttribute('version','%CAT%'); [xml]$p=Get-Content './products.xml';"
    set "p4=$null=$h.AppendChild($r.ImportNode($p.PublishedMedia,$true)); $r.Save('./products.xml')"
    if defined XML powershell -noprofile -c "%p1% %p2% %p3% %p4%"
    :: patch XML url for EULAs as older MCT has issues downloading them specially under naked Windows 7 host (likely TLS issue)
    set "EULA_FIX=http://download.microsoft.com/download/C/0/3/C036B882-9F99-4BC9-A4B5-69370C4E17E9"
    set "p5=foreach ($e in $p.MCT.Catalogs.Catalog.PublishedMedia.EULAS.EULA){$e.URL='%EULA_FIX%/EULA'+($e.URL -split '/EULA')[1]}"
    powershell -noprofile -c "[xml]$p = Get-Content './products.xml'; %p5%; $p.Save('./products.xml')"
    :: patch XML to unhide combined business editions in products.xml that include them: 1709, 1803, 1809
    set "p6=foreach ($e in $p.MCT.Catalogs.Catalog.PublishedMedia.Files.File){ if ($e.Edition -eq 'Enterprise'){"
    set "p7= $e.IsRetailOnly = 'False'; $e.Edition_Loc = 'Windows 10 ' + $e.Edition } }"
    if "%UNHIDE_BUSINESS%"=="yes" powershell -noprofile -c "[xml]$p=Get-Content './products.xml';%p6%%p7%;$p.Save('./products.xml')"
    :: patch XML to create individual business editions in products.xml that never included them: 1607, 1703
    call :create_business >nul 2>nul
    :: repack XML into CAB
    makecab products.xml products.cab >nul
    :: finally launch MCT with local configuration and optional launch parameters
    if /i "%OPTIONS:/MigChoice Upgrade=%"=="%OPTIONS%" start "" MediaCreationTool%V%.exe /Selfhost %OPTIONS% & exit/b
    :: if Upgrade selected, wait for MCT to finish then run setupprep with parameteres directly to overcome MCT limitations
    set OPTIONS=/Selfhost %OPTIONS% /PostOOBE "%~dp0setupcomplete.cmd" & if not exist setupcomplete.cmd cd.>setupcomplete.cmd
    set "p1=MediaCreationTool%V%.exe /Selfhost %OPTIONS% /Action CreateUpgradeMedia /NoFinalize"
    set "p2=(if not exist C:\ESD\Windows\sources\setupprep.exe exit)"
    set "p3=echo start \"setup\" \"%%~dp0sources\setupprep.exe\" %OPTIONS% > C:\ESD\Windows\auto.bat"
    set "p4=start \"setup\" /min cmd.exe /c C:\ESD\Windows\auto.bat"
    powershell -c "Start-Process cmd.exe -ArgumentList '/c %p1% & %p2% & %p3% & %p4%' -WindowStyle Hidden"
    exit/b

    :choices dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    set "snippet=iex(([io.file]::ReadAllText('%~f0')-split':PS_CHOICE\:.*')[1]); Choices %*"
    (for /f "usebackq" %%s in (`powershell -noprofile -c "%snippet:"='%"`) do set "%~1=%%s") &exit/b :PS_CHOICE:
    function Choices($outputvar,$choices,$sel=1,$caption='Choose',[byte]$sz=12,$bc='MidnightBlue',$fc='Snow',[string]$min='400') {
    [void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $f=New-Object System.Windows.Forms.Form;
    $bt=@(); $i=1; $global:rez=''; $ch=($choices+',Cancel').split(','); $ch | foreach { $b=New-Object System.Windows.Forms.Button;
    $b.Name=$i; $b.Text=$_; $b.Font='Tahoma,'+$sz; $b.Margin='0,0,9,9'; $b.Location='9,'+($sz*3*$i-$sz); $b.MinimumSize=$min+',18';
    $b.AutoSize=1; $b.cursor='Hand'; $b.add_Click({$global:rez=$this.Name;$f.Close()}); $f.Controls.Add($b); $bt+=$b; $i++ }
    $f.Text=$caption; $f.BackColor=$bc; $f.ForeColor=$fc; $f.StartPosition=4; $f.AutoSize=1; $f.AutoSizeMode=0; $f.MaximizeBox=0;
    $f.AcceptButton=$bt[$sel-1]; $f.CancelButton=$bt[-1]; $f.Add_Shown({$f.Activate();$bt[$sel-1].focus()}); $null=$f.ShowDialog();
    if($global:rez -ne $ch.length){ return $global:rez }else{ return $null } } :PS_CHOICE:
    :: Let's Make Console Scripts Friendlier Initiative by AveYo - MIT License - call :choices rez "one, 2 two, three" 3 'Usage'

    ::==============================================================================================================================
    :NOTICE: IF INTERESTED IN BUSINESS EDITIONS FOR 1607 AND 1703 TOO, GET THE FULL SCRIPT FROM THE LINKS AT THE TOP
    ::==============================================================================================================================
    #^_^#
  29. AveYo revised this gist May 28, 2020. 4 changed files with 43 additions and 15 deletions.
    1 change: 1 addition & 0 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,5 @@ Update: adjusted script for easy splitting into a lite version (only missing gen
    added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    2019.11.16: 19H2 18363.418 as default choice (updated hard-coded links)
    2020.02.29: 19H2 18363.592
    2020.05.28: 2004 19041.264 first release
    ```
    19 changes: 14 additions & 5 deletions MediaCreationTool lite.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @echo off &title MediaCreationTool.bat by AveYo v2019.02.29 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @echo off &title MediaCreationTool.bat by AveYo v2020.05.28 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    @@ -13,6 +13,7 @@
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)
    :: - 2004 19041.264 first release

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"
    @@ -36,24 +37,32 @@ rem set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade
    rem set "OPTIONS=%OPTIONS% /Console /DiagnosticPrompt enable /NoReboot"

    :: Uncomment to bypass gui dialog choice and hardcode the version: 1=1607,2=1703,3=1709,4=1803,5=1809,6=1903,7=1909,8=LATEST
    rem set/a MCT_VERSION=7
    rem set/a MCT_VERSION=8

    :: Available MCT versions
    set versions= 1607 [RS1], 1703 [RS2], 1709 [RS3], 1803 [RS4], 1809 [RS5], 1903 [19H1], 1909 [19H2], LATEST MCT
    set versions= 1607, 1703, 1709, 1803, 1809, 1903, 1909, 2004, LATEST MCT

    :: Show dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 7 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 8 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION echo No MCT_VERSION selected, exiting.. & timeout /t 5 & exit/b
    goto version-%MCT_VERSION%

    :version-8 - LATEST MCT
    :version-9 - LATEST MCT
    set "V="
    set "B=LATEST AVAILABLE VIA MCT"
    set "D="
    set "CAB=http://go.microsoft.com/fwlink/?LinkId=841361"
    set "MCT=http://go.microsoft.com/fwlink/?LinkId=691209"
    goto process

    :version-8
    set "V=2004"
    set "B=19041.264.200511-0456"
    set "D=_20200514"
    set "CAB=http://download.microsoft.com/download/8/6/e/86e2d7b8-59b3-442b-8306-6697fc52b2bd/products_20200514.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe"
    goto process

    :version-7
    set "V=1909"
    set "B=18363.592.200109-2016"
    19 changes: 14 additions & 5 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @echo off &title MediaCreationTool.bat by AveYo v2019.02.29 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @echo off &title MediaCreationTool.bat by AveYo v2020.05.28 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    @@ -13,6 +13,7 @@
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)
    :: - 2004 19041.264 first release

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"
    @@ -36,24 +37,32 @@ rem set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade
    rem set "OPTIONS=%OPTIONS% /Console /DiagnosticPrompt enable /NoReboot"

    :: Uncomment to bypass gui dialog choice and hardcode the version: 1=1607,2=1703,3=1709,4=1803,5=1809,6=1903,7=1909,8=LATEST
    rem set/a MCT_VERSION=7
    rem set/a MCT_VERSION=8

    :: Available MCT versions
    set versions= 1607 [RS1], 1703 [RS2], 1709 [RS3], 1803 [RS4], 1809 [RS5], 1903 [19H1], 1909 [19H2], LATEST MCT
    set versions= 1607, 1703, 1709, 1803, 1809, 1903, 1909, 2004, LATEST MCT

    :: Show dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 7 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 8 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION echo No MCT_VERSION selected, exiting.. & timeout /t 5 & exit/b
    goto version-%MCT_VERSION%

    :version-8 - LATEST MCT
    :version-9 - LATEST MCT
    set "V="
    set "B=LATEST AVAILABLE VIA MCT"
    set "D="
    set "CAB=http://go.microsoft.com/fwlink/?LinkId=841361"
    set "MCT=http://go.microsoft.com/fwlink/?LinkId=691209"
    goto process

    :version-8
    set "V=2004"
    set "B=19041.264.200511-0456"
    set "D=_20200514"
    set "CAB=http://download.microsoft.com/download/8/6/e/86e2d7b8-59b3-442b-8306-6697fc52b2bd/products_20200514.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe"
    goto process

    :version-7
    set "V=1909"
    set "B=18363.592.200109-2016"
    19 changes: 14 additions & 5 deletions MediaCreationTool_auto_upgrade.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @echo off &title MediaCreationTool.bat by AveYo v2019.02.29 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @echo off &title MediaCreationTool.bat by AveYo v2020.05.28 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    @@ -13,6 +13,7 @@
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)
    :: - 2004 19041.264 first release

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"
    @@ -36,24 +37,32 @@ set OPTIONS=%OPTIONS% /Eula Accept /MigChoice Upgrade /Auto Upgrade
    rem set "OPTIONS=%OPTIONS% /Console /DiagnosticPrompt enable /NoReboot"

    :: Uncomment to bypass gui dialog choice and hardcode the version: 1=1607,2=1703,3=1709,4=1803,5=1809,6=1903,7=1909,8=LATEST
    set/a MCT_VERSION=7
    set/a MCT_VERSION=8

    :: Available MCT versions
    set versions= 1607 [RS1], 1703 [RS2], 1709 [RS3], 1803 [RS4], 1809 [RS5], 1903 [19H1], 1909 [19H2], LATEST MCT
    set versions= 1607, 1703, 1709, 1803, 1809, 1903, 1909, 2004, LATEST MCT

    :: Show dialog w buttons: 1=outvar 2="choices" 3=selected [optional] 4="caption" 5=textsize 6=backcolor 7=textcolor 8=minsize
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 7 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION call :choices MCT_VERSION "%versions%" 8 "Choose MCT Windows 10 Version:" 15 0xff180052 Snow 400
    if not defined MCT_VERSION echo No MCT_VERSION selected, exiting.. & timeout /t 5 & exit/b
    goto version-%MCT_VERSION%

    :version-8 - LATEST MCT
    :version-9 - LATEST MCT
    set "V="
    set "B=LATEST AVAILABLE VIA MCT"
    set "D="
    set "CAB=http://go.microsoft.com/fwlink/?LinkId=841361"
    set "MCT=http://go.microsoft.com/fwlink/?LinkId=691209"
    goto process

    :version-8
    set "V=2004"
    set "B=19041.264.200511-0456"
    set "D=_20200514"
    set "CAB=http://download.microsoft.com/download/8/6/e/86e2d7b8-59b3-442b-8306-6697fc52b2bd/products_20200514.cab"
    set "MCT=http://software-download.microsoft.com/download/pr/MediaCreationTool2004.exe"
    goto process

    :version-7
    set "V=1909"
    set "B=18363.592.200109-2016"
  30. AveYo revised this gist Feb 29, 2020. 4 changed files with 27 additions and 26 deletions.
    23 changes: 12 additions & 11 deletions .. MediaCreationTool.bat .md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,15 @@
    ![Preview1](https://i.imgur.com/YfBThX8.png)
    ![Preview2](https://i.imgur.com/wSd1DlZ.png)
    ![Preview1](https://i.imgur.com/YfBThX8.png)
    ![Preview2](https://i.imgur.com/wSd1DlZ.png)

    Update: adjusted script for easy splitting into a lite version (only missing generating RS1/RS2 business entries)
    Update: adjusted script for easy splitting into a lite version (only missing generating RS1/RS2 business entries)
    ```
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
    2018.10.12: added data loss warning for RS5
    2018.11.13: RS5 is officially back! + greatly improved choices dialog - feel free to use the small snippet in your own scripts
    2019.05.22: 1903 [19H1]
    2019.07.11: 1903 __release_svc_refresh__ and enable DynamicUpdate by default to grab latest CU
    2019.09.29: UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
    2018.10.12: added data loss warning for RS5
    2018.11.13: RS5 is officially back! + greatly improved choices dialog - feel free to use the small snippet in your own scripts
    2019.05.22: 1903 [19H1]
    2019.07.11: 1903 __release_svc_refresh__ and enable DynamicUpdate by default to grab latest CU
    2019.09.29: UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    2019.11.16: 19H2 18363.418 as default choice (updated hard-coded links)
    ```
    2020.02.29: 19H2 18363.592
    ```
    10 changes: 5 additions & 5 deletions MediaCreationTool lite.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @echo off &title MediaCreationTool.bat by AveYo v2019.11.16 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @echo off &title MediaCreationTool.bat by AveYo v2019.02.29 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    @@ -12,7 +12,7 @@
    :: - added Auto Upgrade launch options preset with support for a setupcomplete.cmd in the current folder
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.418 as default choice (updated hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"
    @@ -56,9 +56,9 @@ goto process

    :version-7
    set "V=1909"
    set "B=18363.418.191007-0143"
    set "D=_20191014"
    set "CAB=http://download.microsoft.com/download/1/7/5/175fceb0-34f3-425d-8bdf-c4bd72be5f29/products_20191014.cab"
    set "B=18363.592.200109-2016"
    set "D=_20200116"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    goto process

    10 changes: 5 additions & 5 deletions MediaCreationTool.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @echo off &title MediaCreationTool.bat by AveYo v2019.11.16 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @echo off &title MediaCreationTool.bat by AveYo v2019.02.29 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    @@ -12,7 +12,7 @@
    :: - added Auto Upgrade launch options preset with support for a setupcomplete.cmd in the current folder
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.418 as default choice (updated hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"
    @@ -56,9 +56,9 @@ goto process

    :version-7
    set "V=1909"
    set "B=18363.418.191007-0143"
    set "D=_20191014"
    set "CAB=http://download.microsoft.com/download/1/7/5/175fceb0-34f3-425d-8bdf-c4bd72be5f29/products_20191014.cab"
    set "B=18363.592.200109-2016"
    set "D=_20200116"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    goto process

    10 changes: 5 additions & 5 deletions MediaCreationTool_auto_upgrade.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    @echo off &title MediaCreationTool.bat by AveYo v2019.11.16 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    @echo off &title MediaCreationTool.bat by AveYo v2019.02.29 || pastebin.com/bBw0Avc4 or git.io/MediaCreationTool.bat
    :: Universal MediaCreationTool wrapper for all MCT Windows 10 versions from 1607 to 1909
    :: Using as source nothing but microsoft-hosted original files for the current and past MCT Windows 10 releases
    :: Ingenious full support for business editions (Enterprise / VL) selecting language, x86, x64 or AIO inside MCT GUI
    @@ -12,7 +12,7 @@
    :: - added Auto Upgrade launch options preset with support for a setupcomplete.cmd in the current folder
    :: - UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
    :: - added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
    :: - 19H2 18363.418 as default choice (updated hard-coded links)
    :: - 19H2 18363.592 as default choice (updated hard-coded links)

    :: Comment to not unhide combined business editions in products.xml that include them: 1709+
    set "UNHIDE_BUSINESS=yes"
    @@ -56,9 +56,9 @@ goto process

    :version-7
    set "V=1909"
    set "B=18363.418.191007-0143"
    set "D=_20191014"
    set "CAB=http://download.microsoft.com/download/1/7/5/175fceb0-34f3-425d-8bdf-c4bd72be5f29/products_20191014.cab"
    set "B=18363.592.200109-2016"
    set "D=_20200116"
    set "CAB=http://download.microsoft.com/download/8/2/b/82b12fa5-cab6-4d37-8167-16630c6151eb/products_20200116.cab"
    set "MCT=http://download.microsoft.com/download/c/0/b/c0b2b254-54f1-42de-bfe5-82effe499ee0/MediaCreationTool1909.exe"
    goto process