DOCUMENTATION & SETUP GUIDE

Section required for review

README - Complete Guide to Folder Structures, Custom Setup Wrappers, Script Systems & Installer Options for tetoOS ISO Modification.

1. Overview

Folder placement follows the native Windows $OEM$ folder mechanism. This wrapper was created to apply customizations during the installation process, so after progress reaches 100%, the computer can be left unattended without waiting for OOBE to finish.

This wrapper does not eliminate OOBE, but rather moves most of the post-installation workload into the Windows setup stage. The entry point is reads StartSetup.ini to display OS/edition selection and then copies the appropriate $oem$ folder to the installation media.

Advantages of this Method:
  • • Users can unplug the USB drive after 100% progress.
  • • Tweaks and software can be installed while setup is running.
  • • No need to wait at the computer during OOBE.
  • • Compatible with standard $oem$ structure.
Critical Warning:
Scripts running too early, taking too long, or containing invalid syntax can still cause:
  • Indefinite Just a moment screen;
  • Recurring boot loops;
  • CONFIG_INITIALIZATION_FAILED;
  • User profile corruption;
  • Deadlocks during OOBE phase.

This system is designed as an extension of the Windows $oem$ mechanism. Folders, scripts, and configuration files (StartSetup.ini, OS_Settings.ini) are deeply interconnected. An error in one component can disrupt the entire installation process.

2. StartSetup.ini Structure

The primary configuration file read to manage OS selection and setup UI timeout.

Example StartSetup.ini Content:
[OSList]
Windows 11=11|10.0.22000
Windows 10=10|10.0.<22000
Windows 8.1=8.1|6.3
Windows 7=7|6.1
 
[Unattend]
SetupUILangDefault=en-US
OSDefault=10
Key / Parameter Function & Explanation
[OSList] List of selectable operating systems. Format: Label=Code|Build version. The < symbol denotes "lower than" (e.g. 10.0.<22000 = Windows 10).
SetupAutoStart_Timeout Seconds before setup auto-starts without user intervention.
SetupUILangDefault Default setup UI language (e.g. en-US).
OSDefault OS code selected by default (matches code in [OSList]).
OSPage_Hide If uncommented (=1), hides the OS selection page.
OSPage_Timeout Seconds before the OS selection page automatically advances to the next step.

3. Folder Structure & $OEM$ Mapping

Below are the physical folders packaged inside the Setup. Numeric prefixes (e.g. OS_) denote target OS codes defined in [OSList] - 10 = Windows 10.

Per-OS $oem$ Folders
Folder Function
OS_$oem$ Identical to native Windows $OEM$ folder for the respective OS (in this case Windows 10).
OS_$oem$_2 Same as $OEM$, but applied immediately without installer options. Contains Media, Resources\Themes, Setup\Scripts\Patches, etc.
Shared $oem$ Folders (Cross-OS)
Folder Function
$oem$_shared Applied to all Windows architectures.
$oem$_shared_x64 Applied exclusively to 64-bit Windows.
$oem$_shared_x86 Applied exclusively to 32-bit Windows.
$oem$_scripts_shared Scripts always copied & executed (contains Activator, Tweaks, Tweaks_forced, _Drivers.cmd, _Soft.cmd, cmdow.exe).
$oem$_scripts_options_shared Copied to C:\Windows\Scripts only when selected in installer options (OS_Settings.ini). E.g. 7-Zip.
$oem$_scripts_options_8+ Same as above, but restricted to Windows 8 and later.
Standard $OEM$ Folder Mapping
Source Folder Destination Extraction on Target System
$1C:\
$$C:\Windows
$$\Setup\ScriptsC:\Windows\Setup\Scripts (primary stage scripts location)
$DocsUser Documents folder
$ProgsC:\Program Files
$Progs32C:\Program Files (x86)
$UsersC:\Users
Mapping Examples:
• OS_$oem$\$1\Users\Public\Desktop → copied to C:\Users\Public\Desktop
• OS_$oem$\$$\Setup\Scripts\SetupComplete.cmd → copied to C:\Windows\Setup\Scripts\SetupComplete.cmd
Important Notes:
  • Folders ending in _options require user selection in the installer.
  • Folders ending in _2 are always applied automatically.
  • OS_Settings.ini configures tweaks and installer options for that OS.
  • Incorrect folder placement may cause tweaks or scripts not to execute at all.

4. Script System

Contents of $$\Setup\Scripts are copied to C:\Windows\Setup\Scripts and executed automatically during matching installation phases. Primary stage scripts reside in OS_$oem$\$$\Setup\Scripts.

Execution Order of Stage Scripts:
1. Specialize.cmd → 2. OOBE.cmd → 3. SetupComplete.cmd → 4. FirstLogonCommands.cmd → 5. FirstLogonCommandsDesktop.cmd
Tweak Calling Pattern (Crucial):

Each stage script loops through tweak folders and invokes _InstallOption_<Stage>.cmd if present. Note: the filename uses _InstallOption_ (singular), NOT _InstallOptions_.

Snippet from Specialize.cmd:
@echo off
"%~dp0cmdow.exe" @ /HID
cd "%~dp0"
 
if exist "%~dp0specialize.DONE" exit
 
for %%x in (tweaks_forced\*.reg) do regedit /s "%%x"
 
for /d %%B in ("%~dp0*") do (
    if exist "%%B\_InstallOption_Specialize.cmd" (
        call "%%B\_InstallOption_Specialize.cmd"
    )
)
 
@echo Prevent double launch>"%~dp0specialize.DONE"
exit
  • • cmdow.exe @ /HID hides the CMD console window while background stages execute.
  • • .DONE marker files (e.g. specialize.DONE, FirstLogonCommands.DONE) prevent redundant/looping executions.
  • • Tweaks_forced\*.reg are applied without options; folder tweaks use _InstallOption_<Stage>.cmd.

5. _InstallOption_*.cmd Files & Mechanism

The filename dictates the exact installation stage where the tweak is triggered by the wrapper.

System Recognized Stage Names:
_InstallOption_Specialize.cmd _InstallOption_OOBE.cmd _InstallOption_SetupComplete.cmd _InstallOption_FirstLogon.cmd _InstallOption_FirstLogonDesktop.cmd
Special Tweak Collections:
• Tweaks in Tweaks_forced (e.g. Control_Defender, Control_UpdateCenter) are invoked directly via _Install.cmd from OOBE.cmd - not via _InstallOption_.
• The Skipped folder contains intentionally disabled tweaks (using __InstallOption_Specialize.cmd with double underscores so the system skips looping it).
Installer Workflow & Configuration:

The installer reads OS_Settings.ini, scans for matching _InstallOption_*.cmd files in target tweak folders, and executes them at the designated stage after user confirmation.

# Folder Structure:
$oem$_scripts_options_8+\0.StartMenu
  └── _InstallOption_SetupComplete.cmd
  └── _InstallOption_FirstLogonDesktop.cmd
 
# Configuration in OS_Settings.ini:
[Option:StartIsBack]
Checked=0
en-US=Windows 7 Start Menu
Dir=$oem$_scripts_options_8+\0.StartMenu

Result: "Windows 7 Start Menu" tweak runs at SetupComplete and FirstLogonDesktop stages if checked by user during install.

Steps to Add a New Tweak:
  1. Create a new folder inside Tweaks (or Tweaks_forced for mandatory tweaks).
  2. Add _InstallOption_<Stage>.cmd to define execution timing (or _Install.cmd for Tweaks_forced).
  3. Place supporting files such as .reg, .cmd, .ps1, or .exe in the same folder.
  4. Register the folder in OS_Settings.ini (for optional installer tweaks).

6. OS_Settings.ini Structure

OS_Settings.ini is utilized by the installer to specify target images/editions, unattend options, and the list of tweaks presented to users. It connects tweak labels to script folders. Stored as UTF-16LE.

Section [WIM-ESD]

Defines image sources, WIM/ESD index assignments, and Office image targets.

[WIM-ESD]
OSImage_1=sources\install.esd
OSImage_2=sources\install.wim
OfficeImage=sources\o_office_24.esd,1
IfOfficeImageNotExist=WIM-ESD\o_office_24.esd,1
WinRE_x86=sources\boot.wim,1
WinRE_x64=sources\boot.wim,1
Section [EditionsListFull-HighFromLow]

Maps Windows editions (e.g. Core, Enterprise) alongside language tags and edition upgrade paths.

[EditionsListFull-HighFromLow]
CoreSingleLanguage=Core
Core=CoreSingleLanguage
Professional=Core,CoreSingleLanguage
;Education:NNNNN-NNNNN-NNNNN-NNNNN-NNNNN=Core,CoreSingleLanguage
Enterprise:NNNNN-NNNNN-NNNNN-NNNNN-NNNNN=Professional,Core,CoreSingleLanguage
LTSC21=
LSTC19=
IoTEnterprise=Enterprise
Section [Unattend]

Configures edition page behavior and installer customization defaults.

[Unattend]
EditionDefault=IoTEnterpriseS
SEditionDefault_Architecture=x64
SEditionDefault_InstallLang=en-US
OSPage_SystemUserName=Admin
OSPage_ComputerName=*
OSPage_Workgroup=WORKGROUP
OSPage_ActivateWindows=0
OSPage_InstallDrivers=0
OSPage_TurnOff_UAC=0
OSPage_TurnOff_Defender=0
OSPage_TurnOff_Firewall=0
Section [Option:*]

Each optional tweak is defined as an [Option:Name] block. Language labels (e.g. en-US=) display in the installer UI; Dir= targets the tweak folder; Checked= determines default selection state.

[Option:7Zip]
Checked=1
en-US=7-Zip
Dir=$oem$_scripts_options_shared\7-Zip
 
[Option:StartIsBack]
Checked=0
en-US=Windows 7 Start Menu
Dir=$oem$_scripts_options_8+\0.StartMenu
 
[Option:Theme]
Checked=0
en-US=No anime wallpaper
Dir=$oem$_scripts_options_8+\Theme
Note: Folders listed in OS_Settings.ini will still be copied, but without a matching _InstallOption_<Stage>.cmd file, scripts won't execute - files are simply copied over.

7. CMD Script Writing Guide

Most tweaks are executed through .cmd or .bat files. Minor mistakes can cause excessive setup delays, boot failures, or OOBE stalls.

Basic CMD Script Structure:
@echo off
cd /d "%~dp0"
setlocal EnableExtensions EnableDelayedExpansion
 
REM === Write customization commands here ===
 
exit /b
Practical Script Writing Guidelines:
  • • Always terminate scripts with exit /b (or exit for main stage scripts) so the installer can proceed.
  • • Use call when invoking external CMD files; otherwise, the parent script terminates prematurely.
  • • Use start /wait whenever external installers must finish before continuing.
  • • Begin stage scripts with cd /d "%~dp0" and "%~dp0cmdow.exe" @ /HID to conceal CMD console windows.
  • • Leverage .DONE markers to prevent scripts from executing repeatedly.
  • • Avoid interactive dialogs such as pause, choice, or msgbox during installation.
  • • Avoid issuing restart, shutdown, or logoff commands unless strictly mandatory.
  • • Wrap all system paths in double quotes, e.g. "%SystemRoot%\Setup\Scripts".
  • • Test every tweak standalone before integrating into the master installer package.
Installation Stage Breakdown Table:
Installation Stage Recommended Usage
Specialize Driver injection, system registry, early hardware configuration, and tweaks_forced\*.reg execution.
OOBE User account creation, light tweaks, and executing _Install.cmd for Control_Defender / UpdateCenter.
SetupComplete Built-in software installation, system patches, Windows activation, and residual cleanup (OneDrive, defaultuser0).
FirstLogonCommands Specific configuration for new user profiles upon initial login.
FirstLogonCommandsDesktop Taskbar, Start Menu, Windows Explorer settings, and visual desktop interface tweaks.

8. Common Errors & Debugging Tips

Most Frequent Mistakes:
  • • Forgetting to append exit /b at the end of the script.
  • • Using start without the /wait switch, causing process overlap.
  • • Calling secondary scripts directly without the call keyword.
  • • Running application installers that require interactive user input (non-silent).
  • • Assigning tweaks to the wrong stage (e.g. running UI desktop tweaks during Specialize).
  • • Typos in filename: using _InstallOptions_ (plural) instead of _InstallOption_ (singular).
  • • Tweak folder name mismatching the Dir= entry in OS_Settings.ini.
Debugging Checklist Tips:

If your tweak or customization fails to execute during setup, verify the following:

  1. Verify the tweak folder is registered under the Dir= line in OS_Settings.ini.
  2. Ensure the physical folder name matches the INI file entry exactly (case-sensitive safe).
  3. Verify the existence of _InstallOption_<Stage>.cmd (singular spelling without "s").
  4. Check if a leftover .DONE marker file from previous attempts is blocking execution.
  5. Test the script manually inside a running live Windows instance to verify functionality.
  6. Add debug logging like echo Stage OK >> C:\log.txt to track execution line by line.