Jump to content

"auto detect" RunOnceEx?


Orsi

Recommended Posts

Hey there, I'm build an AIODVD with XP 32bits, XP 64 bits e so on, now I need to know if its possible to write a RunOnceEx.cmd file which automatically detects what OS I am installing.

I need to know this 'cause some software are not Win x64 compatible, like NIS 2006.

Link to comment
Share on other sites


Oh man your going to make me have to reply to this...s***.

Been out of the loop for a while.

Okay you'll need to make an entry into your WinNT.sif file, in your I386 folder

[GuiRunOnce]
"%systemdrive%\Install\RunOnce.exe"

Now the RunOnce.exe or what ever you wish to call it...is your yet to be compiled AutoIt script.

The compiled script will be placed in "$OEM$\$1\Install\" folder on your CD\DVD.

Now I'm guessing...but ether the AutoIt macro @OSVersion or @OSBuild should return a value that will tell you whether or not you have XP32 or XP64 installed...you'll have to test...but your compiled script should look some thing like so:

If @OSVersion = "WIN_XP" Then
Run ( @COMSPEC " /c Start " & @HomeDrive & "\Install\RunOnce32.cmd" )
Else
Run ( @COMSPEC " /c Start " & @HomeDrive & "\Install\RunOnce64.cmd" )
EndIf

Exit

Both RunOnce32.cmd & RunOnce64.cmd files would be of course placed in your "$OEM$\$1\Install\" folder on your CD\DVD.

Both files would be written like so:

cmdow @ /HID
@echo off

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

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

REG ADD %KEY%\005 /VE /D "Adobe Reader 6" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\install\AdobeReader6\AR6.msi /qn" /f

REG ADD %KEY%\010 /VE /D "Alcohol 120" /f
REG ADD %KEY%\010 /V 1 /D "%systemdrive%\install\alcohol\setup.exe /qn" /f
REG ADD %KEY%\010 /V 2 /D "REGEDIT /S %systemdrive%\install\alcohol\register.reg" /f

REG ADD %KEY%\015 /VE /D "Diskeeper 8" /f
...

rundll32.exe iernonce.dll,RunOnceExProcess

Tho of course with only the files you want to install per OS.

The important part is:

rundll32.exe iernonce.dll,RunOnceExProcess

Since the base cmd file will populate the RunOnce reg entry...and the line above will then force every thing thats been entered into the entry to then run at that point.

My self I would keep it all AutoIt...hence no cmd files what so ever...but that makes things some what more complex to explain...even tho over all working code is simpler...and just one compiled file.

Thats me tho. :)

If your interested you should be able to search the forum for posts done by my self and Mhz on the subject of replacing RunOnce with AutoIt...tho my primary in depth post about it I think...I may have nuked on a bad hair day.

Any ways the above code samples should get you well on your way.

Link to comment
Share on other sites

If @OSVersion = "WIN_XP" Then
Run ( @COMSPEC " /c Start " & @HomeDrive & "\Install\RunOnce32.cmd" )
Else
Run ( @COMSPEC " /c Start " & @HomeDrive & "\Install\RunOnce64.cmd" )
EndIf

Exit

Nice extensive explaination, Nologic.

Would recommend hiding those cmd file windows for better presentation ?

If @OSVersion = "WIN_XP" Then
Run ( @HomeDrive & "\Install\RunOnce32.cmd", "", @SW_HIDE )
Else
Run ( @HomeDrive & "\Install\RunOnce64.cmd", "", @SW_HIDE )
EndIf

Exit

The more up to date AutoIt Beta has @ProcessorArch which returns one of the following: "X86", "IA64", "X64". That could be also an option.

A 64 bit OS also has a WOW64 key in registry that could be checked for existance.

Perhaps for a DOS solution is %OS% ? XP 32 here is set at "Windows_NT". I do not know the XP 64 value atm. Type set in a command window to find out on a XP 64 OS.

Link to comment
Share on other sites

tks guys but I can't make it work :(

Here's the AutoIt code:

If @OSVersion = "WIN_2003" Then

Run (@HomeDrive & "\Install\RunOnce64.cmd")

Else

Run (@HomeDrive & "\Install\RunOnce32.cmd" )

EndIf

Exit

(WIN_2003 is the XP 64's @OSVersion)

the script runs without any error message but the RunOnce code isn't added to the registry

what am I doing wrong?

Link to comment
Share on other sites

If the cmd files did not exist then an AutoIt fatal error would occur as you have taken no steps to suppress it. The code you display is working code so you must have a mistake in your cmd file which is not adding the registry entries ? Perhaps if you want to attach or post your cmd scripts, then the problem could be recognized.

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...