Jump to content

Windows 2000 RunOnceEx using INF


Recommended Posts

I apologize if this is a repeat thread, but I've come up with nothing related in my searches.

First let me explain what I'm trying to do. I'm performing an unattended FDV install of Windows 2000. I'm using RunOnceEx to automatically install software before first user logon. I've added an INF to TXTSETUP.SIF which creates the RunOnceEx entries for installation. I'm installing the software from the same Windows CD.

When textmode setup runs, it copies my INF to the harddrive. This way, RunOnceEx is executed at the 13min mark - before cmdlines.txt or svcpack.inf, and before first user logon. I believe that using TXTSETUP.SIF is the only way to make RunOnceEx happen before first logon.

Why am I using an INF file to install? Windows 2000 doesn't natively support REG ADD commands, and I'd rather not introduce Windows XP binaries. I'm not using reg files because the CD drive may change depending on hardware, so I can't hard code that. I'd rather not use cmd files either, just too messy. INF's are much more elegant. But I'm running into a problem. My software is all located on the CD.

How do I make an inf file residing on the harddisk point to the (correct) CD drive? The closest I've gotten is to write a script that detects the correct CD drive, and appends an entry to the INF under the [strings] section. Not a very good solution, but acceptible. Only thing is, it needs to run AFTER the inf is copied to the harddisk, but BEFORE the RunOnceEx registry entries are executed at T-13. How do I achieve that? Also, where would the inf installer be located at that time?

Thanks in advance!

Link to comment
Share on other sites


Okay, I think I've got that problem solved.

I added the following line to DetachedProgram line to the [GuiUnattended] section of WINNT.SIF:

DetachedProgram = %SystemDrive%\runoncex.cmd

I don't need quotes on that, do I?

runoncex.cmd is a file I've added to TXTSETUP.SIF to copy to the system drive. Contents:

@ECHO off
FOR %%i IN (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:\CDROM_IP.5 SET CDROM=%%i:

IF EXIST %CDROM%\CDROM_IP.5 (ECHO Software = "%CDROM%\SOFTWARE" >> %SystemRoot%\inf\runoncex.inf) ELSE (COPY /Y %SystemDrive%\runoncex.nul %SystemRoot%\inf\runoncex.inf)

If it doesn't locate the CD, it'll overwrite runoncex.inf file with runoncex.nul, which just contains registry modifications.

Someone please tell me if you spot an error - I won't have this ready to test for some time.

Here's my new problem. I know from Microsoft that Windows 2000 supports the "Start /wait [command]" script, but when I add it to RunOnceEx and test it, I get the "Cannot find file start (or one of its components)..." error message. If I launch "start /wait notepad" from the command prompt, it works as expected - notepad opens and the command prompt halts until notepad closes. How do I make this work with RunOnceEx? My brain hurts...

EDIT: typo fix

Edited by Artisan
Link to comment
Share on other sites

Here's my new problem. I know from Microsoft that Windows 2000 supports the "Start /wait [command]" script, but when I add it to RunOnceEx and test it, I get the "Cannot find file start (or one of its components)..." error message. If I launch "start /wait notepad" from the command prompt, it works as expected - notepad opens and the command prompt halts until notepad closes. How do I make this work with RunOnceEx? My brain hurts...
I've removed most of your message, but nevertheless you are asking for help with a problem which doesn't appear anywhere in your post!

The command you need in a runonceex.cmd is:

  • %comspec% /c start /wait

If you are using a runonceex.inf then the following is what I'd suggest:

  • %11%\cmd.exe /c start /wait

Link to comment
Share on other sites

Hi Artisan!

Nice to see a fellow Win2k/FDV user :thumbup

I'm really not an expert on infs i must admit, but couldn't you just do something like e.g.:

[SourceDisksNames]
1 = "Windows 2000 CD",\cdrom_ip.5,,\SOFTWARE

And then use dirid '%1%' to point to '%cdrom%\SOFTWARE' in your RunOnceEx reg-entries ?

If i'm way of here, then i apologise in advance...

CU, Martin.

Link to comment
Share on other sites

@Yzöwl:

Perhaps I could have been clearer, but thanks for helping anyway!

Didn't realize I had to be so literal with the 'start' command, but it works now! Thanks much!

@Martin H:

Doesn't appear to be enough of us Win2K/FDV'ers here... :no:

I already tried the approach you suggested, but the path for [sourceDisksNames] is relative to the script location. (Took me a while to figure that part out...) My inf is getting copied to %SystemRoot%\inf (accomplished by TXTSETUP.SIF with entry "runoncex.inf = 1,,,,,,,20,0,0") before it actually installs, so it'll look there for cdrom_ip.5. It won't find it, but it'll assume that %1% = %SystemRoot%\inf\SOFTWARE. Which would cause all kinds of fun...

Actually, now that I look at it again, I don't think I have to copy it to the inf's folder. I'm referencing Gosh's Guide, and I think I can point it to the CD correctly. More research required!

Link to comment
Share on other sites

Ohh, i'm sorry for butting in then...

Anyway, if it was me, then i would avoid copying anything over to HDD and instead do something like e.g.:

Place runonceex.inf into '\$OEM$'.

Place cmdlines.txt into '\$OEM$':

[COMMANDS]
"rundll32.exe advpack.dll,LaunchINFSection runonceex.inf,DefaultInstall"
"rundll32.exe iernonce.dll,RunOnceExProcess"

Place your apps into e.g. '\$OEM$\RunOnceEx' and then use dirid '%01%\RunOnceEx'.

If you wanted to have the app-install folder into the root, then do instead e.g.:

Place runonceex.inf into '\SOFTWARE'.

Place cmdlines.txt into '\$OEM$':

[COMMANDS]
"rundll32.exe advpack.dll,LaunchINFSection ..\SOFTWARE\runonceex.inf,DefaultInstall"
"rundll32.exe iernonce.dll,RunOnceExProcess"

Place your apps into '\SOFTWARE' and then use dirid '%01%' to reference '%cdrom%\SOFTWARE'.

Edit: Forgot to say that in these examples, then the RunOnceEx reg-entries are imported at T-12 and then immidiately after executed...

Edited by Martin H
Link to comment
Share on other sites

I like the way you make that execute immediately there, very nice.

But putting everything in an $OEM$ folder causes it to be automatically copied to the harddisk. Any chance it could be made to reference the CD instead? I'd like to be able to (easily) install from CD, rather than copy to the harddisk.

EDIT: Wait, that's only select $OEM$ sub-dirs that get copied, right? This may be easier than I thought...

Edited by Artisan
Link to comment
Share on other sites

Nothing is copied to HDD in my examples...

Only the contents of these folders are copied over:

  • \$OEM$\$Docs
  • \$OEM$\$Progs
  • \$OEM$\$$
  • \$OEM$\$1

And 'OemPreinstall=Yes' also needs to be enabled in winnt.sif...

Edit: Ohh sorry - i missed your edit :)

Edited by Martin H
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...