Support
10-01-2002, 10:44 AM
<HTML><HEAD><TITLE>HOWTO: Make a Program Run Every Time the System Starts</TITLE></HEAD><BODY><h3>HOWTO: Make a Program Run Every Time the System Starts </h3><b>Document ID: IR02015</b><hr>The information in this article applies to:<ul><li>Setup Factory 6.0</li></ul><hr><h3>SUMMARY</h3><p>This article explains how to make a program run every time the system starts.</p><h3>DISCUSSION</h3><p>Certain programs run each time the system starts; some are necessary for the operating system to function, and others to provide convenience to the end user. It may be necessary that your program be launched each time the system starts; fortunately Setup Factory can accomplish this easily.<br><br><b>Note</b>: It is considered poor etiquette to do this on a user's system unless it is an essential process, service, or they have agreed to it.<br><br>Making your program run every time the system starts amounts to nothing more then creating a Registry entry in the: "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\Run" Registry key. The Registry value that you create can be called anything (as long at its length is less then 32 characters), and its value should be the full path to the executable that will be launched when the computer boots.<br><br><b>Note</b>: Since you will be modifying the "HKEY_LOCAL_MACHINE" Registry key make sure that your user has administrative permissions by using the %IsUserNTAdmin% built-in variable. For more information see knowledge base article <b>IR02010</b>: "HOWTO: Detect Administrator Privileges".<br><br><b>Example</b><br><br>Here is an example of a <b>Modify Registry</b> action that will set our program "%AppDir%\MyProgram.exe" to run each time the computer starts.<br><br><b>Note:</b> You can place this action on any event during your installation, however it is recommended that this action be placed on the "Before Installing" or "After Installing" event:<br><br><PRE><code><b>Registry Action</b>: Set Value<br><b>Main Key</b>: HKEY_LOCAL_MACHINE<br><b>Sub Key</b>: Software\Microsoft\Windows\CurrentVersion\Run<Br><b>Value name</b>: My Program<br><b>Value type</b>: REG_SZ<br><b>Value data</b>: %AppDir%\MyProgram.exe<br></code></PRE>This action creates an entry in the "Run" key, which will make our program "MyProgram.exe" launch each time the computer reboots. Since we created this Registry value using an action we will also have to remove the value using an action during the uninstall. If we do not remove this value the user will receive error messages informing them that "MyProgram.exe" could not be found.<br><br>Put this action on either the "Before Uninstalling" or "After Uninstalling" event:<PRE><code><b>Registry Action</b>: Delete Value<br><b>Main Key</b>: HKEY_LOCAL_MACHINE<br><b>Sub Key</b>: Software\Microsoft\Windows\CurrentVersion\Run<Br><b>Value name</b>: My Program<br></code></PRE></p><h3>MORE INFORMATION</h3><p>For more information please see the following topics in the Setup Factory 6.0 Help:<br><br><li><b>Command Reference | Actions | Individual Actions | Modify Registry</b></li></p><p>KEYWORDS: Setup Factory, Registry, Modify Registry</p><hr><FONT SIZE=1>Last reviewed: October 1, 2002<br>Copyright © 2002 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br></FONT></BODY></HTML>