Jump to content

Runonce help


Recommended Posts


New to MSFN..

Im building an unattended XP cd with nlite, I can manage addons tweaks etc.. but i could not figure out how to install applications in RunOnce?

let's say I have a Setup.exe.. where to put it and where to give what command?

please help me out im not a programmer..

Link to comment
Share on other sites

You could use $OEM$ folders. Like YOUR_XP_FOLDER\$OEM$\$1\Install or use the CD to hold the setup.exe and then use %source%.

$OEM$ folders: http://unattended.msfn.org/unattended.xp/view/web/18/

%source%: unattendedrunonce.png

As far as the command. You need to look around for the silent switches. Search here for the program name and Google "program name silent switches". Sometimes a program will tell you if you run it with the /? switch.

Link to comment
Share on other sites

I have tried your method and it did not work may be I've done something wrong..

Ok here is What i want

I want to put some applications in Windows CD, in eg svpack or $OEm, the i want them to install at first logon wher a window comes in and says Installing Apss. etc.. then they should be installed from Windows CD, instead of copying to C:\.. etc..

I want them to be installed directly from CD, I have tried cmdlines but could not make it.. hope I could manage it :wacko:

Link to comment
Share on other sites

1 - Make a BAT (or CMD file) to Silently Install (example)

start "" /wait "%SYSTEMDRIVE%\TEMP\setup.exe" /QUIET /NORESTART

2 - Do this is Notepad and "save as" (e.g.) "setup.BAT"

3 - Put the saved file in


4 - Put the setup file (the EXE) in


5 - Now go back and look at the link, info, and photo -X- gave CAREFULLY

It works that way. ;)

Edited by submix8c
Link to comment
Share on other sites

... i want them to install at first logon wher a window comes in and says Installing Apss. etc.. then they should be installed from Windows CD, instead of copying to C:\.. etc..

I want them to be installed directly from CD, ...

Another option:

Create your addons to be executed by the runonce. By this method, the Setup routine will be created in the Windows registry and the installation will take place at runconce. The addons may be added to your XPCD with nlite.

For this, read this tutorial:


Link to comment
Share on other sites


first of all thank you again.

I've tried every possible thing and by mistakes I could not make anything but then I came across here http://unattended.msfn.org/unattended.xp/view/web/31/, and this method worked like a charm.

for coming newbies I am posting my method.

Here is my cmdlines.txt (which is inside $OEM$ folder

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

the add :


it should look like this

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

Then make a folder inside $OEM$ and rename it to $1, then inside $1 make another folder named Apps (or whatever you like) in my case it's "Apps" put your Applications eg CCleaner, FireFox, PowerISO etc in Apps folder...


Now open notepad and put this code:

cmdow @ /HID
@Echo Off

SET PP=%SystemDrive%\Apps\

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

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

REG ADD %KEY%\001 /VE /D "Direct X 9.0" /f
REG ADD %KEY%\001 /V 1 /D "%PP%CCleaner.exe /S" /f


pay attention to "SET PP" it was done by RunOnceEx.cmd Creator, you don't have to put %SystemDrive% in front of every entry SET PP will take care of it. instead of %SystemDrive% we will use %PP% like this


PP will redirect system to the SystemDrive which is mostly C:\ remember during Windows Setup everything inside $OEM$ wii be copied to C:\ eg Apps, so this script will run from C"\, (don't worry it will also be deleted automaticaly in next code) so

Where "REG ADD %KEY%\001 /VE /D "CCleaner" /f" is where we will have to provide a title for the Application.

Next "REG ADD %KEY%\001 /V 1 /D "%PP%CCleaner.exe /S" /f " is where we have to provide the actual executable filname (no path , PP will do it)

next i want to add PowerISO

REG ADD %KEY%\002 /VE /D "PowerISO" /f
REG ADD %KEY%\002 /V 1 /D "%PP%PowerISO.exe /S" /f

remember the %KEY%002, each application should have same numerical order in Title and In File name,

Since PowerISO is commercial Software we will have to add registration information via registry, in my case its poweriso.reg (should be in same directory where we added the application $OEM$ > $1 > Apps.

so let's add the rigistry

REG ADD %KEY%\001 /VE /D "Direct X 9.0" /f
REG ADD %KEY%\001 /V 1 /D "%PP%CCleaner.exe /S" /f
REG ADD %KEY%\001 /V 2 /D "%PP%REGEDIT /S poweriso.reg" /f

Now add you applications like above and at the end add:

REG ADD %KEY%\023 /VE /D "Cleaning up and Rebooting" /f
REG ADD %KEY%\023 /V 1 /D "%PP%cleanup.cmd" /f

now save this file as RunOnceEx.cmd and put inside %OEM% folder where cmdlines.txt lives.

Open notepad again and write

cmdow @ /HID
shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute..."
net user aspnet /delete

RD /S /Q "%AllUsersProfile%\Start Menu\Programs\PrintMe Internet Printing"
RD /S /Q "%AllUsersProfile%\Start Menu\Programs\Java Web Start"

DEL "%systemroot%\*.bmp"
DEL "%systemroot%\Web\Wallpaper\*.jpg"
DEL "%systemroot%\system32\dllcache\*.scr"
DEL "%systemroot%\system32\*.scr"

DEL "%AllUsersProfile%\Start Menu\Windows Update.lnk"
DEL "%AllUsersProfile%\Start Menu\Set Program Access and Defaults.lnk"
DEL "%AllUsersProfile%\Start Menu\Windows Catalog.lnk"

DEL "%UserProfile%\Start Menu\Programs\Windows Media Player.lnk"
DEL "%AllUsersProfile%\Start Menu\Programs\Windows Movie Maker.lnk"
DEL "%AllUsersProfile%\Start Menu\Programs\Adobe Reader 6.0.lnk"

DEL "%UserProfile%\Desktop\Flashget.lnk"
DEL "%AllUsersProfile%\Desktop\Java Web Start.lnk"
DEL "%AllUsersProfile%\Desktop\Adobe Reader 6.0.lnk"
DEL "%AllUsersProfile%\Desktop\Alcohol 120%.lnk"
DEL "%AllUsersProfile%\Desktop\Pak urdu Installer.lnk"

RD /S /Q "%systemroot%\Cache\Adobe Reader 6\"
RD /S /Q %systemdrive%\drivers\
RD /S /Q %systemdrive%\apps\


change it to your needs and save it as cleanup.cmd and put it together with your other applications (Apps) folder,

now download Cmdow from"


extract it to $OEM$ > manke new directory called "$$" the inside $$ make another directory called "system32" and put extracted cmdows to "system32" directory

now you're done Burn the ISO

Remeber I'm not a tutorial writer, sorry for any mistakes.


Link to comment
Share on other sites

XP Install is -

1 - TextMode (copies to HDD) then Reboots

2 - GuiMode Install OS and anything listed in CMDLINES.TXT then Reboots

3 - "Welcome" - This is First Time Logon

See this

Post#2 indicated TWO ways -

a - Using $OEM$ (at ROOT of CD) copies to HDD during TextMode (#1 above) and the link to the structure was given.

b - Using ANY FolderName (at ROOT of CD) + Variable "%source%" (from CD) No Copy To HDD during TextMode as the Screenshot indicated. Sample screenshot in post#2 was from here. Read this explanation.

In both cases #2 above will happen.

In post #4 you indicated "Install At First Logon" (I missed that part, sorry...) and "Directly From CD". I suppose it could be done that way (from CD) if you used the code given in the previous Runonce Explanation link (above) in your RunonceEX (gets the CD-Drive Letter).

Your method was from a link within Post#7 which was specifically for CD (second way). You opted for HDD (first way) and the Alternative Finding CD way is in above link. A simple modification to the CMD's would allow for Second Way (the "SET PP" part).

What we had specifically missed was that you wanted it all to happen during User First Logon, i.e. RunonceEX as opposed to Runonce (difference explained here) so it could be "seen".

Either/Or Method is fine - Runonce after First Reboot (#2) during GuiMode or RunonceEX after Second Reboot (#3) during Welcome Logon.

I note that you've linked items already linked in the Unattended. I also not that you've, in essence, done exactly what Unattended said to do. Both of these are alright if your intent is to "log" what you did as an Example to other Members, BUT...

Be forewarned ANYONE that reads the above post - The Procedure Is Specifically For The Original Poster And Is An Example Only!!! Go to the LINKS to get all info on "How To" and construct YOURS according to your needs as THIS ONE is Customized for the OP's purposes. Repeat - DO NOT USE LINE-FOR-LINE -AN EXAMPLE ONLY!!!!

Glad you got it figured out. And you did it on your own. Congratulations. :thumbup

Link to comment
Share on other sites

Sorry for any mistakes, and welcome, could you point me further about first logon, second logon? whatever I did that's a separate issue but you people helped me, it was me not getting actual method,


Link to comment
Share on other sites

As the "See this" link I gave provides.

If you were to Install Attended or do a Sysprep w/MiniSetup then that's the Final Phase of Setup (First Logon) and you (under those circumstances) enter a New User Name, Region, Network Setup, etc.

Again - Textmode/Guimode/Welcome (a visual):


RunonceEX happens after #28 and during #29 before the Desktop finally COMPLETELY displays. Runonce happens BEFORE that.

Anything after that is Using The OS and subsequent Logons are irrelevant to Installation because, well, Installation is complete.

Link to comment
Share on other sites

Other than the fact that there are certain apps that you cannot install too early, since some of the required structure or prerequisites are not in place yet, I think a lot of the rest of the choices as to when in the process your apps are installed comes down to a personal preference. I prefer to do app installs as late in the game as possible, such as RunOnceEX, since the type of app installs that install there can also usually be installed to a running system, making testing of those app installs convenient. Those same type of app installs can usually be used, or easily modified to be used, by tools such as WPI. That way you can keep your app installs on a separate install medium than your OS install, if you prefer, which makes maintenance, updating, testing, etc more flexible and convenient, IMHO. Others have different preferences or opinions. What is important is what works for you in your circumstances.

Cheers and Regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...