Unattended XPCD
   


[GuiRunOnce]
Submitted by Vadikan

[GuiRunOnce] is a section of the answer file (winnt.sif). The section contains the commands launched at the first logon. Typically, the commands are listed one per line. The section title literally means Run Once from GUI (Graphic User Interface). The commands must be enclosed in quotes. During the Windows Setup commands listed in [GuiRunOnce] will be imported to the Registry key

 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce


» Section in action

Generally, [GuiRunOnce] can be used as a simple method of software installation. You can specify a command to launch a batch file containing commands that install software. For example, the file install.cmd is launched from [GuiRunOnce]:

  
    [GuiRunOnce]
      "%systemdrive%\install\install.cmd"  


I imagine you're familiar with the $OEM$ distribution folders and realize that the install.cmd file placed in $OEM$\$1\install\ will be copied to %systemdrive%\install\ during the setup.

You can list several commands in the [GuiRunOnce] section:

    
    [GuiRunOnce]
      "regedit /s %systemdrive%\install\tweak.reg"
      "%systemdrive%\install\install.cmd"
      "%systemdrive%\install\cleanup.cmd"
    
and so on. The commands run sequentially (i.e the second command will run only when the first one is finished).


Note: the [GuiRunOnce] section commands start executing before the shell (explorer) loads. If you have very few tasks to accomplish via [GuiRunOnce], you may not even see them executing. On the other hand, some applications require the shell for the installation, and therefore placing them on the top of the software installation is not recommended.

» Tip

You don't have to go through the entire Windows setup in order to test the software installation from [GuiRunOnce]. The following batch file assumes you have install.cmd in C:\Install:

@echo off

:: Set the registry key for importing the command
set key=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce
:: Import the command
REG ADD %KEY% /V command0 /D "%systemdrive%\install\install.cmd" /f

exit

Save the code as "test.cmd" (with the quotes) and run. Then log off and log on again.
--
Discussion thread
Last updated 2005-12-25 20:01:25 by Vadikan  [Edit]
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001 - 2014 msfn.org
Privacy Policy