title: Launch a program asynchronously at startup on Windows 7, just once, using only the registry
body: <p>The program I am launching is the windows notepad (for a readme file after a program installation requiring a reboot). I am working in Windows 7 Professional, with administrator rights.</p>
  
  <p>I would like to get the following solution working:</p>
  
  <pre><code>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce
  Name: myregentry
  Type: REG_SZ
  Data: notepad.exe C:\test2.txt
  </code></pre>
  
  <p>However, RunOnce is synchronous (<a href="http://msdn.microsoft.com/en-us/library/aa376977%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa376977%28v=vs.85%29.aspx</a>). This results in the notepad launching on top of a completely black screen (<a href="http://tinypic.com/r/aua6p4/5" rel="nofollow">screenshot @ tinypic</a>), with no possibility to do anything but read the text. Startup waits, and resumes only after the notepad window is closed. This is not acceptable for my use (ti would confuse users).</p>
  
  <p>I could get the following solution to work:</p>
  
  <p>1) Create a registry entry:</p>
  
  <pre><code>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce
  Name: myregentry
  Type: REG_SZ
  Data: C:\launchreadme.bat
  </code></pre>
  
  <p>2) Create a self-deleting batch file at C:\launchreadme.bat:</p>
  
  <pre><code>@ECHO OFF
  start notepad.exe C:\test2.txt
  
  REM **** Delete this script ****
  DEL "%~f0"
  </code></pre>
  
  <p>This does what I want. However I'd like to know:</p>
  
  <p><strong>Is there is a cleaner way to do this, without generating this batch file first, so: only using the registry?</strong></p>
  
  <p>This could be useful to others, as the web is full of example of "how to launch the notepad once from the registry", yet none of them (that I could find) mention this issue.</p>
  
  <p>Additional information:</p>
  
  <ol>
  <li><p>I could not get "start" to work in the registry entry (<code>start notepad.exe C:\test1.txt</code> does nothing on startup).</p></li>
  <li><p>RunServicesOnce (instead of RunOnce), which used to launch programs once, asynchronously, apparently doesn't exist anymore in Windows 7.</p></li>
  <li><p>Run (instead of RunOnce) is also asynchronous and works well. But obviously I don't want to launch this readme file after every reboot.</p></li>
  </ol>