durex Posted March 31, 2005 Posted March 31, 2005 Since Ive made the switch to WPI, Ive needed (wanted) to use the recommended method of launching WPI via GuiRunOnce (as opposed to RunOnceEx, which would bring up that extra dialog box). The only problem was I couldnt find any methods which allowed you to launch the programs using the GuiRunOnce method directly from the CD since there isnt any way of detecting the CDROM drive in the WINNT.SIF file. The work around to this, of course, was to either place the program in the $OEM$ directory and launch it from your hard drive, or at the very least, keep your programs on your CDROM, but create an additional batch file, place it in your $OEM$ directory, which would detect your CDROM drive letter and launch your program.Well, after giving it a bit of thought, I figured out a much more streamlined approach to this which will allow you to launch WPI (or anything else for that matter) using the GuiRunOnce method, in another manner.As you may or may not know, when placing a command in the [GuiRunOnce] section of your WINNT.SIF, all it does is create a registry entry under the following section, the value of which is the command itself: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceBeing familiar with the RunOnceEx method, I took this one step further and setup a configuration similiar to that of using RunOnceEx to install your programs directly from your CD.I created a batch file called GuiRunOnce.cmd (can be called anything of course), placed it in a folder '<CD IMG ROOT>\Custom\Scripts'. I than created the cmdlines.txt, which is located in the $OEM$ folder and contains the following:[COMMANDS]"..\Custom\Scripts\GuiRunOnce.cmd"and my GuiRunOnce.cmd:@echo offcmdow @ /HIDfor %%a 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 %%a:\WIN51 set CDROM=%%a:SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceREG ADD %KEY% /V 001 /D "%CDROM%\Custom\WPI\wpi.cmd" /fAs you can see, this reg entry will be imported during the T-12 stage at which cmdlines.txt is executed. The 'wpi.cmd' script, which resides on the CD, will be executed upon 1st logon, in the exact same manner as if you were to include it in the GuiRunOnce section of WINNT.SIF. The only thing to take note here is that I changed HKCU (Current User) with HKLM (Local Machine). The 1st couple times I tested this, when using the HKCU setting, WPI would only launch on the second logon for some reason. Only after making the change to HKLM did it launch after the initial logon.Who knows.. maybe this is old news, but based on my extensive searching and more importantly, this recent thread, I assumed nobody had come up with a solution to this.Anyway.. hope it helps!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now