A question regarding the SetupComplete file

Discussion in 'Scripting' started by alnaloty, Oct 18, 2026.

  1. alnaloty

    alnaloty MDL Junior Member

    Aug 29, 2009
    51
    18
    0
    I have a question about the SetupComplete file when installing Windows 11.

    Are there any errors in this script?

    Code:
    @ECHO OFF
    regedit /s "%windir%\Setup\Scripts\Windows.11.my.tweak.reg"
    TITLE Win Apps - Setup
    PushD "%~dp0"
    
    :: ------------------------------ Microsoft Activator ------------------------------
    
    Set "AppExecutable=MAS_AIO.cmd"
    Set "AppPath=%SystemRoot%\Setup\Programs"
    Set "AppUnattended=//Z-Windows"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    :SKIP
    
    :: ------------------------------ Program Installtons ------------------------------
    
    Set "AppExecutable=WinRAR_x64_7.23-en.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing WinRAR_x64_7.23-en . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=XMPlay.3.8.5.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing XMPlay.3.8.5 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=UltraISO.Premium.Edition 9.7.6.3860.Silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing UltraISO.Premium.Edition 9.7.6.3860 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=iNFekt-v1.0.1-silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing iNFekt-v1.0.1 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=USB.Safely.Remove.Final.7.4.1.1336.Silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing USB.Safely.Remove.Final.7.4.1.1336 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=Speccy.1.32.803_silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing Speccy.1.32.803 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=FoxitReader530.0423_enu_Setup_silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing FoxitReader.5 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=Internet.Download.Manager.6.43.15.silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing Internet.Download.Manager.6.43.15 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=K-Lite.Codec.Pack.Full.20.0.6.Silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing K-Lite.Codec.Pack.Full.20.0.6 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=PotPlayer.1.7.23122.AIO.Silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing PotPlayer.1.7.23122.AIO . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    Set "AppExecutable=StartAllBack.3.9.27.5398.Silent.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing StartAllBack.3.9.27.5398 . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP
    
    
    :: ------------------------------- Windows Settings --------------------------------
    
    ECHO.
    ECHO Disabling Automatic Drive Encryption (BitLocker & TCG/Opal) . . .
    Reg Add "HKLM\SYSTEM\CurrentControlSet\Control\BitLocker" /v "PreventDeviceEncryption" /t REG_DWORD /d "0x1" /f 1>NUL
    Reg Add "HKLM\SOFTWARE\Policies\Microsoft\Windows\EnhancedStorageDevices" /v "TCGSecurityActivationDisabled" /t REG_DWORD /d "0x1" /f 1>NUL
    
    ECHO.
    ECHO Disabling Internet Explorer 11 First Run Wizard . . .
    Reg Add "HKLM\SOFTWARE\Policies\Microsoft\Internet Explorer\Main" /v "DisableFirstRunCustomize" /t REG_DWORD /d "0x1" /f 1>NUL
    
    ECHO.
    ECHO Disabling Microsoft Edge (Chromium) Auto Installation . . .
    Reg Add "HKU\LoadedDefaultUser\Software\Microsoft\Active Setup\Installed Components\{9459C573-B17A-45AE-9F64-1857B5D58CEE}" /v "Version" /t REG_SZ /d "43,0,0,0" /f 1>NUL
    
    ECHO.
    ECHO Removing Microsoft Edge (Chromium) shortcut from the Desktop . . .
    DEL /f "%SystemDrive%\Users\Public\Desktop\Microsoft Edge.lnk" 2>NUL
    
    ::ECHO.
    ::ECHO Setting Google as the default search engine in Microsoft Edge (Chromium) . . .
    ::Reg Add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "ManagedSearchEngines" /t REG_SZ /d "[{\"allow_search_engine_discovery\":true},{\"is_default\":true,\"name\":\"Google\",\"keyword\":\"google.com\",\"search_url\":\"https://www.google.com/search?q={searchTerms}\",\"suggest_url\":\"https://www.google.com/complete/search?output=chrome^&q={searchTerms}\",\"image_search_url\":\"https://www.google.com/searchbyimage?image_url=sbiupload\"}]" /f 1>NUL
    
    ECHO.
    ECHO Disabling OneDrive Auto Installation . . .
    Reg Delete "HKU\LoadedDefaultUser\Software\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f 1>NUL
    
    ECHO.
    ECHO Removing OneDrive shortcut from the Start menu . . .
    DEL /f "%SystemDrive%\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" 2>NUL
    
    ECHO.
    ECHO Disabling Windows Defender automatic sample submission . . .
    Reg Add "HKLM\SOFTWARE\Microsoft\Windows Defender\Spynet" /v "SubmitSamplesConsent" /t REG_DWORD /d "0x0" /f 1>NUL
    
    ECHO.
    ECHO ---------------------------------[ Completed ]---------------------------------
    ping -n 5 localhost 1>NUL
    EXIT
    
     
  2. alnaloty

    alnaloty MDL Junior Member

    Aug 29, 2009
    51
    18
    0
  3. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    18,941
    102,179
    340
    Multiple batch labels with the same name is not good practice
    it works in your case because cmd interpreter check for label name on the way down, before return to check from top

    you can avoid it with parentheses condition, since you already check if file exists
    i.e. instead:
    Code:
    Set "AppExecutable=WinRAR_x64_7.23-en.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing WinRAR_x64_7.23-en . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    use:
    Code:
    Set "AppExecutable=WinRAR_x64_7.23-en.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Exist "%AppPath%\%AppExecutable%" (
    ECHO.
    ECHO Installing WinRAR_x64_7.23-en . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    )
     
  4. alnaloty

    alnaloty MDL Junior Member

    Aug 29, 2009
    51
    18
    0
    What about the beginning and the end of the script? Are there any errors?
    Specifically regarding the registry and the end of the script?
     
  5. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    18,941
    102,179
    340
    No errors
    but you did not add a line for MAS_AIO.cmd execution
     
  6. alnaloty

    alnaloty MDL Junior Member

    Aug 29, 2009
    51
    18
    0
    Code:
    @ECHO OFF
    TITLE Win Apps - Setup
    PushD "%~dp0"
    
    ECHO                                      \\!//
    ECHO                                      (o o)
    ECHO ---------------------------------oOOo-(_)-oOOo---------------------------------
    ECHO      Over the next few minutes you will see automated installations of
    ECHO        various Sofware Applications and Settings being implemented.
    ECHO ===============================================================================
    ping -n 5 localhost 1>NUL
    Reg Load "HKU\LoadedDefaultUser" "%SystemDrive%\Users\Default\NTUSER.DAT" 1>NUL
    
    :: ------------------------------ Microsoft Activator ------------------------------
    
    Set "AppExecutable=MAS_AIO.cmd"
    Set "AppPath=%SystemRoot%\Setup\Scripts"
    Set "AppUnattended=//Z-Windows"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    :SKIP
    
    :: ------------------------------ Program Installtons ------------------------------
    
    Set "AppExecutable=WinRAR_x64_7.23-en.exe"
    Set "AppPath=%SystemRoot%\Setup\Files"
    If Not Exist "%AppPath%\%AppExecutable%" GoTo SKIP
    ECHO.
    ECHO Installing WinRAR_x64_7.23-en . . .
    START "" /WAIT "%AppPath%\%AppExecutable%" %AppUnattended%
    :SKIP