setupcomplete.cmd not working

Discussion in 'Windows 7' started by NICK@NUMBER11, Dec 13, 2011.

  1. NICK@NUMBER11

    NICK@NUMBER11 MDL Expert

    Mar 23, 2010
    1,503
    720
    60
    #1 NICK@NUMBER11, Dec 13, 2011
    Last edited by a moderator: Apr 20, 2017
  2. Butterfly_Joe

    Butterfly_Joe MDL Novice

    Feb 5, 2010
    39
    28
    0
    #2 Butterfly_Joe, Dec 13, 2011
    Last edited by a moderator: Apr 20, 2017
    Test it
    Code:
    REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /V "EnableLUA" /T "REG_DWORD" /D "0" /F
    REG ADD "HKCU\Software\Microsoft\Internet Explorer\Main" /V "DisableFirstRunCustomize" /T "REG_DWORD" /D "1" /F
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. urie

    urie Moderator
    Staff Member

    May 21, 2007
    9,039
    3,388
    300
    #3 urie, Dec 13, 2011
    Last edited by a moderator: Apr 20, 2017
    Try adding /f"" to end of each line.

    example fair enough this is for RunonceEx.
    Code:
    REG ADD %KEY%\iAdd /V Inum /D "CMD /C REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v \"Acronis Scheduler2 Service\" /f" /f""
    Or why don't you just not make a registry file and call it through regedit from setupcomplete.cmd
    Code:
    REGEDIT /S %SystemDrive%\APPS\alcohol\alcohol.reg" /f
    forget the paths just an example
     
  4. ffcloud2000

    ffcloud2000 MDL Member

    Oct 23, 2009
    164
    5
    10
    I just create seperate reg files and add these lines to setupcomplete.cmd.. Works peachy for me so far

    regedit /s %WINDIR%\Setup\Scripts\tweaks.reg
    regedit /s %WINDIR%\Setup\Scripts\services.reg
     
  5. HALIKUS

    HALIKUS MDL Addicted

    Jul 29, 2009
    526
    371
    30
    #6 HALIKUS, Dec 14, 2011
    Last edited by a moderator: Apr 20, 2017
    i use an autoit firstlogon.exe that works well and does a few cool things.

    Code:
    #RequireAdmin
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=FirstLogon.ico
    #AutoIt3Wrapper_Compression=4
    #AutoIt3Wrapper_UseX64=n
    #AutoIt3Wrapper_Add_Constants=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;#NoTrayIcon
    #include <File.au3>
    #include <String.au3>
    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    
    HotKeySet("{F1}", "OnF1") ; f1 closes the exe
    DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) ; This disables 32bit applications from being redirected to syswow64 instead of system32 by default ;
    If not IsAdmin() Then; This enables cmd to run as admin
    RunAs($user, $domain, $pass,0,@ScriptName,@ScriptDir)
    Endif
    
    
    Opt("TrayMenuMode", 2)
    
    ; x64 second run close, as firstlogon tends to run twice
    If FileExists(@WindowsDir & "\64.txt") Then
    FileDelete(@WindowsDir & "\64.txt")
    exit
    Else
    EndIf
    
    
    
    ;tidy up
    FileDelete(@StartupCommonDir & "\FirstLogon.lnk")
    FileDelete(@StartMenuCommonDir & "\Default Programs.lnk")
    FileDelete("C:\ShowWPI.ini")
    
    
    ;$gui = GUICreate("FirstLogon.exe.  F1 to cancel", 300, 100, -1, -1, $WS_EX_TOPMOST)
    $gui = GUICreate("FirstLogon.exe.  ** F1 to cancel **", 300, 100, 70, 400, $WS_EX_TOPMOST)
    $OK = GUICtrlCreateLabel("This only runs once.  Just a few moments until desktop...", 10, 27)
    GUISetBkColor(0xF060)
    GUISetState()
    
    
    ; x64 overlay
    If FileExists(@WindowsDir & "\SysWOW64") Then
    MsgBox(4096, "x64", "x64 Overlay", 1)
    DirCopy(@WindowsDir & "\x64", "c:\", 1)
    DirRemove(@WindowsDir & "\x64", 1)
    
    Else
    DirRemove(@WindowsDir & "\x64", 1)
    EndIf
    
    
    
    ;Creating God Folder. Like control panel with all of the options.
    MsgBox(4096, "God Folder", "Creating God shortcut to desktop", 1)
    DirCreate(@UserProfileDir & "\Desktop\GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}")
    ;GUICtrlDelete($OK)
    ;$OK = GUICtrlCreateLabel("Creating God Folder...", 145 - 22 - 22, 27)
    
    
    ;apply tweaks
    MsgBox(4096, "Apply Tweaks", "Applying some useful reg tweaks", 1)
    ;$OK = GUICtrlCreateLabel("Applying some useful reg tweaks", 145 - 20 - 20, 27)
    ;apply Setup\Settings\TWEAKS_Minimal.reg
    RunWait("Regedit /s " & "c:\Windows\Setup\Settings\TWEAKS_Minimal.reg")
    ;apply Setup\Settings\Tweaks\
    $sPath = "c:\Windows\Setup\Settings\Tweaks"
    FileChangeDir($sPath)
    $RegList = _FileListToArray($sPath, "*.reg", 1)
    If IsArray($RegList) Then
    For $i = 1 To $RegList[0]
    RunWait('regedit' & ' /s' & ' "' & $RegList[$i] & '"')
    Next
    EndIf
    
    
    
    ;tidy BCD
    MsgBox(4096, "Tidy BCD", "Tidy BCD store for XP boot entry", 1)
    RunWait(@ComSpec & ' /c ' & "bcdedit /set nx Alwaysoff", "", @SW_HIDE)
    RunWait(@ComSpec & ' /c ' & "bcdedit /pae ForceEnable", "", @SW_HIDE)
    RunWait(@ComSpec & ' /c ' & 'bcdedit /set {ntldr} description "XP"', "", @SW_HIDE)
    RunWait(@ComSpec & ' /c ' & "bcdedit /displayorder {ntldr} /addlast", "", @SW_HIDE)
    RunWait(@ComSpec & ' /c ' & "bcdedit /timeout 10", "", @SW_HIDE)
    
    
    
    ;apply first logon apps
    MsgBox(4096, "Install Apps", "Applying Firstlogon apps.  It may take a minute", 1)
    Global $Location = @WindowsDir & "\Setup\Settings\FirstLogon\"
    $FileList = _FileListToArray($Location, "*.exe", 1)
    $Argument = StringSplit(" ", ",")
    For $x = 1 To UBound($FileList) - 1
    $Runner = FileGetShortName($Location & "\" & $FileList[$x])
    ConsoleWrite($Runner & @CRLF)
    Sleep(1000)
    RunWait($Runner & $Argument, "", @SW_HIDE)
    Next
    
    
    ;apply MSU
    MsgBox(4096, "MSU", "Applying Offline MS Updates", 1)
    Run(@WindowsDir & "\Setup\MSU\MSU_Offline.exe")
    
    
    ;apply firstlogon.cmd
    MsgBox(4096, "Almost done", "Applying Firstlogon.cmd, User Settings and ssWPI", 1)
    Run(@ComSpec & ' /c ' & @WindowsDir & "\Setup\FirstLogon.cmd")
    
    
    ;apply Settings.exe
    Run(@WindowsDir & "\Setup\Settings\Settings.exe")
    
    
    ;run sswpi
    $ssWPI = _FindFilessWPI("ssAppsInstalls\ssWPIInstaller\ssWPI.exe")
    Func _FindFilessWPI($ssWPI, $sSearch3 = "ALL")
    If StringLeft($ssWPI, 1) <> "\" Then $ssWPI = "\" & $ssWPI
    Local $aDrives3 = DriveGetDrive($sSearch3)
    For $i3 = 1 To $aDrives3[0]
    If FileExists($aDrives3[$i3] & $ssWPI) Then Return $aDrives3[$i3]
    Next
    Return SetError(1, 0, "")
    EndFunc   ;==>_FindFilessWPI
    
    FileCopy($ssWPI & "\Autorun.exe", @DesktopCommonDir & "\", 9)
    
    If FileExists("C:\ssWPI.ini") Then
    Run($ssWPI & "\ssAppsInstalls\ssWPIInstaller\ssWPI.exe -Install")
    ;run Autorun.exe if its on the same dvd as sswpi as a bonus
    ;FileCopy($ssWPI & "\Autorun.exe", @DesktopCommonDir & "\", 9)
    ;Run($ssWPI & "\Autorun.exe")
    Exit
    EndIf
    
    
    Func OnF1()
    Exit
    EndFunc   ;==>OnF1
     
  6. mzakho

    mzakho MDL Member

    Nov 22, 2008
    166
    73
    10
    #7 mzakho, Dec 14, 2011
    Last edited by a moderator: Apr 20, 2017

    i tired several time make a registry file and call it through regedit from setupcomplete.cmd

    is work 100%

    start /wait %~dp0InstallTake.reg /s

    registry file namd InstallTake.reg