Problem with RunOnceEx in Windows 7

Discussion in 'Windows 7' started by calpo, Apr 5, 2011.

  1. calpo

    calpo MDL Member

    Apr 23, 2010
    207
    59
    10
    #1 calpo, Apr 5, 2011
    Last edited by a moderator: Apr 20, 2017
    Hi all,

    I'm trying to use RunOnceEx in Windows 7 so that it automatically runs some applications.

    It does NOT work. Please anyone give me some tip to fix that.

    Thanks in advance.

    Here' what I do....

    $OEM$ inside "sources"

    $OEM$\$$\SETUP\SCRIPTS\SetupComplete.cmd

    $OEM$\$1\Install


    SetupComplete.cmd

    Code:
    @echo off
    
    
    REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
    SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx 
    
    REG ADD %KEY% /V TITLE /D "Installing applications" /f
    
    
    REG ADD %KEY%\002 /VE /D "Adobe Flash" /f
    REG ADD %KEY%\002 /V 1 /D "%systemdrive%\Install\Adobe Flash\setup.exe /s" /f
    
    
    REG ADD %KEY%\003/VE /D "Adobe Reader" /f
    REG ADD %KEY%\003 /V 1 /D "%systemdrive%\Install\Adobe Reader\setup.exe /sAll /rs" /f
    
    
    REG ADD %KEY%\004 /VE /D "WinRAR" /f
    REG ADD %KEY%\004 /V 1 /D "%systemdrive%\Install\WinRAR\setup.exe /s" /f
    
    REG ADD %KEY%\005 /VE /D "UltraISO" /f
    REG ADD %KEY%\005 /V 1 /D "%systemdrive%\Install\UltraISO\setup.exe /s" /f
     
    
    regedit /s %systemroot%\setup\scripts\Key.reg

    I create a folder for each application ( such as WinRAR ... UltraISO .... then named application setup.exe and place it in Install folder.

    Key.reg is also placed in Scripts folder
     
  2. rasputinuk

    rasputinuk MDL Member

    May 21, 2007
    106
    6
    10
    #2 rasputinuk, Apr 5, 2011
    Last edited by a moderator: Apr 20, 2017
    Hi,

    This is my own Setupcomplete.cmd

    @ECHO OFF
    Rem : **********************************************
    Rem : * Application and Driver Installation Script *
    REM : ***************For Windows 7 AIO *************
    Rem : **************** By RasputinUK ***************
    REM : ***************** 07-03-2011 *****************
    Rem : **********************************************

    REM : Lets find the Installation Files...If not wait for Disk...

    goto start
    :NoUSB
    CLS
    set USB=""
    CHOICE /c Y /N /T 30 /D Y /M "Please insert Installation Disk..."
    :start
    FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%i:\install\xxmklink.exe" SET USB=%%i:
    SET USB=%USB%\install
    IF not exist %USB%\xxmklink.exe goto NoUSB

    Rem : Set the required variables...

    SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx

    Rem : Copy none-installable files to the System Drive...

    IF %PROCESSOR_ARCHITECTURE%==AMD64 start /wait robocopy %USB%\utorrent "%programfiles%\Utorrent" >NUL
    IF %PROCESSOR_ARCHITECTURE%==AMD64 start /wait robocopy %USB%\DMT "%programfiles(x86)%\DMT" /zb >NUL
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 start /wait robocopy %USB%\entertainment "%programfiles%\Entertainment" /zb >NUL

    REM : Preparing Start menu entries...

    IF %PROCESSOR_ARCHITECTURE%==AMD64 mkdir "%programdata%\microsoft\windows\start menu\programs\Utorrent" >NUL
    IF %PROCESSOR_ARCHITECTURE%==AMD64 mkdir "%programdata%\microsoft\windows\start menu\programs\DMT" >nul
    IF %PROCESSOR_ARCHITECTURE%==AMD64 start /wait %USB%\xxmklink "%programdata%\microsoft\windows\start menu\programs\Utorrent\Utorrent" "%programfiles%\Utorrent\Utorrent.exe" "" "%programfiles%\Utorrent" "Utorrent Client" "" "%programfiles%\Utorrent\Utorrent.exe" >NUL
    IF %PROCESSOR_ARCHITECTURE%==AMD64 start /wait %USB%\xxmklink "%programdata%\microsoft\windows\start menu\programs\DMT\DMT" "%programfiles(x86)%\DMT\DMT.exe" "" "%programfiles(x86)%\DMT" "DSL-Modem Tool" "" "%programfiles(x86)%\DMT\DMT.EXE" >nul
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 mkdir "%programdata%\microsoft\windows\start menu\programs\Games" >NUL
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 start /wait %USB%\xxmklink "%programdata%\microsoft\windows\start menu\programs\games\Golf" "%programfiles%\entertainment\Golf.exe" "" "%programfiles%\entertainment" Golf "" "%programfiles%\entertainment\Golf.ico">NUL
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 start /wait %USB%\xxmklink "%programdata%\microsoft\windows\start menu\programs\games\Tripeaks" "%programfiles%\entertainment\Tripeaks.exe" "" "%programfiles%\entertainment" Tripeaks "" "%programfiles%\entertainment\Tripeaks.ico" >NUL
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 start /wait %USB%\xxmklink "%programdata%\microsoft\windows\start menu\programs\games\cruel" "%programfiles%\entertainment\Cruel.exe" "" "%programfiles%\entertainment" Cruel "" "%programfiles%\entertainment\Cruel.ico" >NUL

    Rem : Defining the RunOnceEx Reg entries...In preparation for final installation...

    REG ADD %KEY% /V Title /D "Installing System Drivers & Applications" /f

    REM : Set-up Non-Silent Installs First

    REG ADD %KEY%\005 /VE /D "Romanza Theme"
    REG ADD %KEY%\005 /V 1 /D "%USB%\romanza\romanza.themepack" /f

    REG ADD %KEY%\010 /VE /D "Windows 7 Toolkit"
    REG ADD %KEY%\010 /V 1 /D "%USB%\toolkit\toolkit" /f

    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\015 /VE /D "VSO ConvertXtoDVD 4"
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\015 /V 1 /D "%USB%\vso\vso.exe" /f
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\015 /V 2 /D "REGEDIT /S %USB%\vso\vso.reg" /f

    REG ADD %KEY%\020 /VE /D "Ashampoo Burning Studio 10"
    REG ADD %KEY%\020 /V 1 /D "%USB%\ashampoo\ashampoo.exe" /f
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\020 /V 2 /D "REGEDIT /S %USB%\ashampoo\regx64.reg" /f
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\020 /V 2 /D "REGEDIT /S %USB%\ashampoo\regx86.reg" /f

    REM : Set-up Silent Installs Now

    REG ADD %KEY%\025 /VE /D "Edimax MFP Printer Client"
    REG ADD %KEY%\025 /V 1 /D "%USB%\edimaxmfp\edimaxmfp.exe -s -f1%usb%\edimaxmfp\setup.iss -f2%windiR%\MFPSetup.txt" /f

    REG ADD %KEY%\030 /VE /D "FoxIt PDF Reader"
    REG ADD %KEY%\030 /V 1 /D "%USB%\foxit\foxit.exe /allow /register /sm" /f

    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\035 /VE /D "UltraISO 9.3.6"
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\035 /V 1 /D "%USB%\ultraiso\ultraiso.exe /VERYSILENT /SP-" /F
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\035 /V 2 /D "REGEDIT /S %USB%\Ultraiso\register.reg" /f

    REG ADD %KEY%\040 /VE /D "ATI Display Driver"
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\040 /V 1 /D "%USB%\ATI\X64\setup.exe -install" /f
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\040 /V 1 /D "%USB%\ATI\X86\setup.exe -install" /f

    REG ADD %KEY%\045 /VE /D "Shark007 Windows 7 Codecs"
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\045 /V 1 /D "regedit /s %USB%\codecs\codec64.reg" /f
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\045 /V 1 /D "regedit /s %USB%\codecs\codec.reg" /f
    REG ADD %KEY%\045 /V 2 /D "%USB%\codecs\win7codecs.msi setup=0 /qn" /f
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\045 /V 3 /D "%USB%\codecs\x64components_v276 -ai" /f

    REG ADD %KEY%\050 /VE /D "WinRAR 393"
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\050 /V 1 /D "%USB%\winrar393\winrar-x64-393.exe -s -s1" /f
    IF NOT %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\050 /V 1 /D "%USB%\winrar393\winrar393.exe -s -s1" /f


    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\055 /VE /D "Logitech Setpoint V620"
    IF %PROCESSOR_ARCHITECTURE%==AMD64 REG ADD %KEY%\055 /V 1 /D "%USB%\logitech\setpoint620_x64 /s /ncrc" /f

    REG ADD %KEY%\065 /VE /D "MicroSoft Office 2007"
    REG ADD %KEY%\065 /V 1 /D "%USB%\office12\setup.exe" /f

    REG ADD %KEY%\070 /VE /D "Avast Anti-Virus Free Edition"
    REG ADD %KEY%\070 /V 1 /D "%USB%\avast\avast.exe /SP- /VERYSILENT /NORESTART" /f

    REM : All done, now clean-up left over install files from system
    REM ; And re-boot.

    REG ADD %KEY%\075 /VE /D "Installation Complete, Up-dating System"
    REG ADD %KEY%\075 /V 1 /D "%USB%\clean.cmd /b" /f

    REM : All Done Enjoy Windows 7 AIO

    Exit



    This one installs my programs for my X64 & X86 systems, I copy my installation folder either to a DVD or USB stick.
    My latest one is to make an all in one installation with SP1, IE9 and ERD3.5 for X86 + X64 and my install folder and copied the whole lot to an 8Gig stick. I hope this gives you some idea of how to do it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. calpo

    calpo MDL Member

    Apr 23, 2010
    207
    59
    10
    @rasputinuk
    Thanks alot for your concern.