[Tutorial] RunOnceEx - Quick and Dirty

Questions or comments on the switchless installers? Want to create a new one? Talk about it here.
Post Reply
User avatar
5eraph
Site Admin
Posts: 4548
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

[Tutorial] RunOnceEx - Quick and Dirty

Post by 5eraph » Sun Apr 06, 2008 5:39 pm

The Commonly Accepted Method (as documented by Alanoll and others at MSFN)
  • Prerequisites for this tutorial:
    • A copy of your Windows source media transferred to hard disk.
    • Familiarity with the RyanVM Integrator or nLite, or other methods to create your own Windows ISOs.
  • This tutorial briefly covers all of the following steps necessary for RunOnceEx (ROE) to function using this method:
    1. Editing an existing WINNT.SIF file.
    2. Creation of a cmdlines.txt file.
    3. Creation of a RunOnceEx.cmd file.
    4. Use of the $OEM$ distribution folders.
  • Optional (but highly recommended) knowledge that will not be explicitly covered:
  • What this tutorial will NOT cover:
    • When or why you should use RunOnceEx as opposed to other methods of installation.
    • Creation of a completely unattended WINNT.SIF file. Please refer to the resources in DEPLOY.CAB on your WinXP Pro source CD or MSFN's Unattended Windows Guide. Or use nLite.
    • The use of nLite. It has its own documentation and forum.
    • Windows Post-Installation Wizard (WPIW). It has its own documentation and subforum on this site.
    • Creation of installers or addons. Many resources can be found elsewhere on this site in the appropriate forums; too many to link in this small space. ;)
    • Switches necessary for certain installers. This has been discussed already with many useful links.
    • Creating or burning bootable ISOs.
1. WINNT.SIF
  • When I first tried following MSFN's guide back in 2005, this is the single step that completely buggered me. It's still not listed, and it's absolutely necessary.

    Make certain the following lines are present in your WINNT.SIF file. The file should be located in I386, or AMD64 if your source is x64, if you have one. Without these lines your $OEM$ distribution folders will fail to copy during Windows setup and ROE will fail.

    Code: Select all

    [Unattended]
        OemPreinstall="Yes"
    The lines above can be used as shown to enable this method of RunOnceEx without any other unattended settings, if desired. Please refer to REF.CHM in DEPLOY.CAB or MSFN's WINNT.SIF Reference for more information.
2. cmdlines.txt
  • Alanoll provides a clear explanation of this file, if you're interested in reading it.

    Create a file named cmdlines.txt in the $OEM$ folder. For our purposes, we'll only be concerned with adding the following two lines to the file:

    Code: Select all

    [COMMANDS]
    "RunOnceEx.cmd"
    Save and exit.
3. RunOnceEx.cmd
  • This file is used to add our installer commandlines to the registry for execution at first logon. If you've been comparing this tutorial to MSFN's so far then you'll notice that cmdow is conspicuously absent in the example file shown below. This is due to the fact that most antivirus applications will flag cmdow.exe as a potential threat. I won't go into why in this tutorial. The choice is yours whether to include cmdow or not. This tutorial will not.

    I'll use the following example to explain how to build this file. Code in color will be explained below.

    Code: Select all

    [color=orange]SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx[/color]
    
    REG ADD [color=orange]%KEY%[/color] /V Title /D "Post-Setup Installation" /f
    
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]05[/color] /VE /D "Microsoft .NET Framework 3.0" /f
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]05[/color] /V [color=cyan]1[/color] /D "%SystemDrive%\Install\dotNET30.exe" /f
    
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]10[/color] /VE /D "Windows Live Messenger 8.1.178 (MessPatched)" /f
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]10[/color] /V [color=cyan]1[/color] /D "%SystemDrive%\Install\LiveMess.exe" /f
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]10[/color] /V [color=cyan]2[/color] /D "REGEDIT /S %systemdrive%\Install\messtweaks.reg" /f
    
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]20[/color] /VE /D "Messenger Plus! Live v4.23.0.276" /f
    REG ADD [color=orange]%KEY%[/color]\[color=yellow]20[/color] /V [color=cyan]1[/color] /D "%SystemDrive%\Install\MsgPlusLive-423.exe /silent" /f
    
    [color=violet]REG ADD %KEY%\99 /VE /D "Cleanup" /f
    REG ADD %KEY%\99 /V 1 /D "%SYSTEMDRIVE%\Install\HideC.exe %SYSTEMDRIVE%\Install\Cleanup.cmd" /f[/color]
    SET KEY - All registry entries in this file will be applied to this key. Setting KEY as an environment variable allows us to use much shorter REG commands with %KEY%.

    ROE number - These values determine the execution order. Letters and numbers can be used here, but be aware that the entire string is evaluated, not the intended number. For example, the following values will be executed in the order given: 05, 10, 6, 65, A1, A2, AA, ZZ. Use leading zeros when necessary as shown in the example above.

    multiple steps - For each installation, several steps can be used. The order is determined with the same rules as the ROE numbers above.

    Cleanup - This step is optional, but recommended for use in all installations.

    For encapsulated quotes, what to use in your Cleanup.cmd, and other RunOnceEx.cmd details please refer to MSFN's guide. HideC.exe (A.K.A. RunHiddenConsole.exe) can be found on MSFN.
4. $OEM$ Distribution Folders
  • I can't explain them much better than Alanoll, so I won't. ;) Please refer to his guide for the proper layout the folders must have, paying particular attention to I386, $OEM$, $1, and Install. All of your ROE installers should be placed in the Install folder. RunOnceEx.cmd and cmdlines.txt should be located in $OEM$. WINNT.SIF should be in I386 unless your source is x64. Any deviation from what's given will cause ROE to fail.
Changelog:
  • [2010/08/27 22:30 UTC] - v1.03 - Updated MSFN forum links. Apparently, some link formats cost money to use. Free links that should always work are now used.
  • [2008/05/20 03:30 UTC] - v1.02 - Updated links to DEPLOY.CAB from SP2 version to SP3 version.
  • [2008/04/06 22:50 UTC] - v1.01 - Corrected discrepancies, added a link to step 1, and included a link to HideC.exe on MSFN.
  • [2008/04/06 21:40 UTC] - v1.00 - Initial posting.
Last edited by 5eraph on Fri Aug 27, 2010 6:33 pm, edited 7 times in total.

Chax0
Posts: 2
Joined: Fri Nov 28, 2008 8:17 am

Post by Chax0 » Sun Dec 07, 2008 9:52 pm

Please correct the incorrect spelling from 'ROE' to the correct spelling 'ROW'. Otherwise, you did a good job explaining the working of the RunOnceEx.

User avatar
5eraph
Site Admin
Posts: 4548
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Wed Dec 17, 2008 1:29 am

RunOnceEx.

ROW makes no sense to me as an acronym in this context. But thanks for the compliment. :)

User avatar
ricktendo64
Posts: 3212
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Wed Dec 17, 2008 10:45 am

5er want to see a neet trick on howto make SVCPACK RunOnceEx installers?

I think its in part 3 http://www.wincert.net/forum/index.php?showtopic=4659

User avatar
yumeyao
Moderator
Posts: 1718
Joined: Sun Aug 27, 2006 9:24 pm
Location: Taiyuan, Shanxi, PR China

Post by yumeyao » Wed Dec 17, 2008 11:08 am

i see. you use REG Add at T-13 so it runs at the next boot. this was the way i install D-Tools (SPTD at T-13, DTools at the first logon)
and i also heard the voice, is that you ?
Image
My work list(Hosted by dumpydooby)

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Sat May 23, 2009 5:08 am

hi, im hav trouble using a both a cmd and a runonceex.cmd, the cmd runs at the T12-13 mark witch installs 62 things and the runonceex.cmd witch only installs 2 things, the runonce does com up at first login. both work if i only install a few things with the cmd, can u please help?
sorry if ive posted in the wrong place!

User avatar
5eraph
Site Admin
Posts: 4548
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Sat May 23, 2009 7:50 am

I'm not sure that I understand the problem. I need more information:
  1. How do you execute your CMD file? (SvcPack.inf, CmdLines.txt, other? Please be specific.)
  2. Do you use the method described in the first post of this thread to execute RunOnceEx.cmd?
  3. What fails? Under what conditions does the failure occur? Please be as specific as possible.
  4. May I see the CMD files?

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Sat May 23, 2009 9:13 am

hi,
1. by the cmdlines.txt,
2. i hav follow this is one, first?
3. nothing happens windows just starts up normally
4. of course you can (please let me know if i can make it better) http://rapidshare.com/files/236320535/setup.cmd
heres the runonceex.cmd too http://rapidshare.com/files/236321771/RunOnceEx.cmd
my drivers get installed with nLite (video, wireless, sound ETC)
thanks james

Raoul90
Posts: 675
Joined: Thu Jan 17, 2008 10:29 am
Location: The Netherlands

Post by Raoul90 » Sat May 23, 2009 11:03 am

I prefer using:
http://unattended.msfn.org/unattended.xp/view/web/59/
RunOnceEx from CD.


Maybee make the RunOnceEx file like this:
cmdow @ /HID
@Echo Off

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

REG ADD %KEY% /V TITLE /D "Installing Programs" /f

REG ADD %KEY%\005 /VE /D "Installing Easy CD-DA Extractor" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\install\Easy_silent.exe" /f

REG ADD %KEY%\010 /VE /D "Installing Daemon Tools Lite" /f
REG ADD %KEY%\010 /V 1 /D "%systemdrive%\install\DTwSPTD.exe" /f

REG ADD %KEY%\015 /VE /D "Installing WinRAR Vista Theme" /f
REG ADD %KEY%\015 /V 1 /D "%systemdrive%\install\Vista_theme.exe" /f

REG ADD %KEY%\020 /VE /D "Cleaning Up" /f
REG ADD %KEY%\020 /V 1 /D "%SYSTEMROOT%\CleanUp\CleanUP.cmd" /f

EXIT

The "setup.cmd" is a mess, lol. You call that file @ cmdlines?
So in your cmdlines there is "setup.cmd"?

I think this little thing might be a good thing for you:
http://www.ryanvm.net/forum/viewtopic.p ... nstalltips

Much easier, just make this your cmdlines.txt:
[COMMANDS]

"RunOnceEx.cmd"

"InstallTips.exe"
Just edit the "InstallTips.ini"

example:
The above "COMMANDS" part:
[COMMANDS]
1=dotNET-AIO-NLD.exe
2=PowerISO44.exe /S
3=Messenger.exe
4=AutoIt.exe /S
5=AdbeRdr910_nl_NL.exe /sAll /rs /l /msi"/qb-! /norestart ALLUSERS=1 EULA_ACCEPT=YES SUPPRESS_APP_LAUNCH=YES"
6=Java6u13.exe
Lower "InstallTips" part:
[InstallTips]
0= Finishing..
1= Installing: dotNET All-in-One
2= Installing: PowerISO 4.4
3= Installing: Windows Live Messenger 2009
4= Installing: AutoIT
5= Installing: Adobe Reader 9.1
6= Installing: Java 6 Update 13
Good luck!

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Sat May 23, 2009 3:33 pm

Raoul90 wrote:The "setup.cmd" is a mess, lol. You call that file @ cmdlines?
So in your cmdlines there is "setup.cmd"?
hi, yeah i know lol, yes in my cmdlines is the setup.cmd.
that InstallTips.exe looks good got 1 question if i make 1 with all my app in it how easy is it 2 add other app, say i 1er put a new app under Autoit will i hav to edit all the numbers on the side
thanks james

Raoul90
Posts: 675
Joined: Thu Jan 17, 2008 10:29 am
Location: The Netherlands

Post by Raoul90 » Sat May 23, 2009 6:16 pm

jamesbebby wrote:
Raoul90 wrote:The "setup.cmd" is a mess, lol. You call that file @ cmdlines?
So in your cmdlines there is "setup.cmd"?
hi, yeah i know lol, yes in my cmdlines is the setup.cmd.
that InstallTips.exe looks good got 1 question if i make 1 with all my app in it how easy is it 2 add other app, say i 1er put a new app under Autoit will i hav to edit all the numbers on the side
thanks james
You just make the whole .ini now and if you want to add something after autoit just make it like this:
4=AutoIt.exe /S
4a=Blabla.exe /S

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Sun May 24, 2009 9:52 am

hi, think im goin 2 give that installtips a miss, surely it just works in the same way as my setup.cmd, i just ran my windows with your runonceex.cmd and the cmdlines.txt in the same way as u posted
[COMMANDS]
"RunOnceEx.cmd"
"setup.cmd"
but still know luck the runonceex does'nt come up, do think my setup.cmd is to big to run with runonceex?
thanks james

Raoul90
Posts: 675
Joined: Thu Jan 17, 2008 10:29 am
Location: The Netherlands

Post by Raoul90 » Sun May 24, 2009 10:49 am

I think that your Setup.CMD is a big mess, as I said.
So I think that you should use InstallTips.
Much clearer then the setup.cmd.

And the following is in your runonceex.cmd?
cmdow @ /HID
@Echo Off

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

REG ADD %KEY% /V TITLE /D "Installing Programs" /f

REG ADD %KEY%\005 /VE /D "Installing Easy CD-DA Extractor" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\install\Easy_silent.exe" /f

REG ADD %KEY%\010 /VE /D "Installing Daemon Tools Lite" /f
REG ADD %KEY%\010 /V 1 /D "%systemdrive%\install\DTwSPTD.exe" /f

REG ADD %KEY%\015 /VE /D "Installing WinRAR Vista Theme" /f
REG ADD %KEY%\015 /V 1 /D "%systemdrive%\install\Vista_theme.exe" /f

REG ADD %KEY%\020 /VE /D "Cleaning Up" /f
REG ADD %KEY%\020 /V 1 /D "%SYSTEMROOT%\CleanUp\CleanUP.cmd" /f

EXIT
[Unattended]
OemPreinstall="Yes"
That entry is in your winnt.sif?

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Sun May 24, 2009 2:55 pm

hi, it does'nt really look a mess to me, i find it really easy to work with, i do admit it does need sortin out and i will get round to it as soon as i get my RunOnceEx workin,
yes a hav copy your RunOnceEx text.
hers my winnt.sif http://rapidshare.com/files/236799604/WINNT.SIF and my cmdlines.txt http://rapidshare.com/files/236928424/cmdlines.txt
i really do appreciate all the help u r give me
thanks james

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Tue May 26, 2009 10:11 am

hi, just took off the cmdow @ /HID, @Echo Off & put a pause in it so i could see whats goin on, and this is what i get

Code: Select all

[Commands]
"rundll32 advpack.dll,LaunchINFSection nLite.inf,U"

"RunOnceEx.cmd"

"setup.cmd"


Code: Select all

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

REG ADD %KEY% /V TITLE /D "Installing Programs" /f

REG ADD %KEY%\005 /VE /D "Installing Easy CD-DA Extractor" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\install\Easy_silent.exe" /f

REG ADD %KEY%\010 /VE /D "Installing Daemon Tools Lite" /f
REG ADD %KEY%\010 /V 1 /D "%systemdrive%\install\DTwSPTD.exe" /f

REG ADD %KEY%\015 /VE /D "Installing WinRAR Vista Theme" /f
REG ADD %KEY%\015 /V 1 /D "%systemdrive%\install\Vista_theme.exe" /f

REG ADD %KEY%\020 /VE /D "Cleaning Up" /f
REG ADD %KEY%\020 /V 1 /D "%SYSTEMROOT%\CleanUp\CleanUP.cmd" /f

Pause

EXIT 
Image
but still no luck nothing comes up on first login,
cheers james

User avatar
5eraph
Site Admin
Posts: 4548
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Tue May 26, 2009 10:28 am

Are you slipstreaming IE7 or IE8? If so, which one?

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Tue May 26, 2009 10:41 am

hi, yes IE7

User avatar
5eraph
Site Admin
Posts: 4548
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Tue May 26, 2009 11:12 am

The original installer for IE7 includes a version of IERnOnce.dll that breaks RunOnceEx. As a test, replace the newer version of that file with the original IE6 version from your source CD, then try installing again.

For reference, how do you slipstream IE7?
  1. I slipstream the installer and its updates directly with nLite.
  2. I use MrNxDmX's IE7 addon.
  3. I use OnePiece's IE7 addon or addon creator.
  4. I use somebody else's addon. (Please provide a link.)

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Tue May 26, 2009 11:30 am

hi, what ive just done is delete my hole SVCPACK folder and start again, ive just download MrNxDmX's IE7 addon, and this Update Pack http://red.caek.org/addons/. should i go ahead and test it all? or im a missin something?
thanks james

do i need all this crap at the top?

Code: Select all

"rundll32 advpack.dll,LaunchINFSection nLite.inf,U"

User avatar
5eraph
Site Admin
Posts: 4548
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Tue May 26, 2009 11:43 am

My suggestions:
  • Start with a clean source. Deleting the SvcPack folder is not enough.
  • When testing, change one thing at a time between tests. Otherwise there is no way to know which change fixed the problem. (I'm a fan of the Scientific Method. ;))

User avatar
jamesbebby
Posts: 161
Joined: Fri Mar 13, 2009 10:32 am

Post by jamesbebby » Tue May 26, 2009 1:24 pm

o.k thanks for your help

User avatar
Bhishmar
Posts: 138
Joined: Mon Dec 25, 2006 2:42 pm

Post by Bhishmar » Sat Sep 26, 2009 4:07 am

@5eraph
This may be old. But just revising my Unattended/Swithless Installer basics.

A mention of "CWnd.exe" tool from n7epsilon, as a better replacement for cmdow.exe, is in order in your 1st post i think.

His latest ver 1.1, dtd 19 march 2008, is stable & near full replacement for cmdow
http://www.ryanvm.net/forum/viewtopic.php?p=56212#56212

regards

Leeemi1107
Posts: 1
Joined: Tue Jan 09, 2018 12:48 am
Contact:

Re: [Tutorial] RunOnceEx - Quick and Dirty

Post by Leeemi1107 » Thu Jan 11, 2018 8:13 am

Thanks for good post . i like this and love... !!!

khouji
Posts: 3
Joined: Mon Jan 15, 2018 12:09 am

Re: [Tutorial] RunOnceEx - Quick and Dirty

Post by khouji » Mon Jan 15, 2018 9:39 pm

Thank you for the information!

Post Reply