Microsoft KB Archive/173039: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 46: Line 46:
       [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
       [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
       \RunOnce]
       \RunOnce]
       &quot;doit&quot;=&quot;c:\\test\\test.cmd&quot; </pre></li>
       "doit"="c:\\test\\test.cmd" </pre></li>
<li><p>Using Notepad.exe, enter the following lines, and then save as Cmdlines.cmd in the Test directory:<br />
<li><p>Using Notepad.exe, enter the following lines, and then save as Cmdlines.cmd in the Test directory:<br />
</p>
</p>
Line 60: Line 60:
</p>
</p>
<pre class="FIXEDTEXT">      [Version]
<pre class="FIXEDTEXT">      [Version]
       Signature = &quot;$Windows NT$&quot;
       Signature = "$Windows NT$"


       [DefaultInstall]
       [DefaultInstall]
Line 76: Line 76:


<pre class="FIXEDTEXT">  [Commands]
<pre class="FIXEDTEXT">  [Commands]
   &quot;rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\test.INF&quot;
   "rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\test.INF"
   &quot;REGEDIT.EXE /s .\RUNONCE.REG&quot; </pre>
   "REGEDIT.EXE /s .\RUNONCE.REG" </pre>
<br />
<br />
For additional information on Windows NT 4.0 deployment and unattended installation, download the Windows NT 4.0 Deployment Guide from the following web site:
For additional information on Windows NT 4.0 deployment and unattended installation, download the Windows NT 4.0 Deployment Guide from the following web site:

Latest revision as of 11:07, 21 July 2020

RUNONCE Key Is Processed Immediately When RUNDLL32 Is Called



The information in this article applies to:


  • Microsoft Windows NT Workstation version 4.0
  • Microsoft Windows NT Server version 4.0
  • Microsoft Windows 95
  • Microsoft Windows 2000 Professional
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server





SUMMARY

If you place items in the RUNONCE key so that they will run the next time you log on, they will run as soon as Rundll32.exe is run, whether or not logging on is in progress. This is a design feature of Rundll32.exe for Windows NT 4.0 Server and Workstation.

This feature can cause problems, however, during an unattended installation of Windows NT version 4.0 using the Cmdlines.txt option. This article discusses these possible problems and some ways to avoid them.



MORE INFORMATION

To produce the desired results from the RUNONCE key, it is very important not to add any values to it before running Rundll32.exe options. This includes using a Windows 95-style .inf to add the RUNONCE registry values.

You can re-create and examine the effects of launching Rundll32.exe when there is a RUNONCE value ready to run by using the following steps:

  1. Create a directory called Test.
  2. Using Notepad.exe, enter the following lines, and then save as Runonce.reg in the Test directory:

          REGEDIT4
    
          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
          \RunOnce]
          "doit"="c:\\test\\test.cmd" 
  3. Using Notepad.exe, enter the following lines, and then save as Cmdlines.cmd in the Test directory:

          @ECHO OFF
          REGEDIT.EXE /s RUNONCE.REG
          rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\test.INF 
  4. Using Notepad.exe, enter the following lines, and then save as Test.cmd in the Test directory:

          @echo off
          ECHO HELLO WORLD
          PAUSE 
  5. Using Notepad.exe, enter the following lines, and then save as Test.inf in the Test directory:

          [Version]
          Signature = "$Windows NT$"
    
          [DefaultInstall]
          AddReg = AddReg
          DelReg = DelReg
          UpdateInis = UpdateInis
    
          [AddReg]
          [DelReg]
          [UpdateInis] 
  6. From an MS-DOS prompt, run Cmdlines.cmd; you will see that the file Test.cmd runs.

The following example shows the file Cmdlines.txt located in the $OEM$ directory of a Windows NT Deployment share, with the proper order to run Rundll32.exe and a Regedit script for Runonce. Optimally, it would be best to run all Rundll32.exe statements before running Regedit scripts.


   [Commands]
   "rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\test.INF"
   "REGEDIT.EXE /s .\RUNONCE.REG" 


For additional information on Windows NT 4.0 deployment and unattended installation, download the Windows NT 4.0 Deployment Guide from the following web site:

http://www.microsoft.com/ntworkstation/info/deployguide.htm

NOTE: The deployment guide is valid for both Windows NT Workstation and Windows NT Server.

Additional query words:

Keywords : kbsetup ntsetup ntreskit NTSrvWkst
Version : WINDOWS:2000,95; winnt:4.0
Platform : WINDOWS winnt
Issue type : kbprb
Technology :


Last Reviewed: January 21, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.