<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: relaunch code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 09:36:38 GMT</pubDate>
    <description>DZone Snippets: relaunch code</description>
    <item>
      <title>Automatically restarting an application in Windows</title>
      <link>http://snippets.dzone.com/posts/show/4431</link>
      <description>This script will start a program and automatically relaunch it if it closes.  It's a stripped down version of the script in &lt;a href="http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9635"&gt;JSI Tip 9635: How can I start an application, and automatically restart it if the user ends it?&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Set WshShell = CreateObject("WScript.Shell")&lt;br /&gt;Do While True&lt;br /&gt; WshShell.Run """&lt;the path to the executable file&gt;""", 1, True&lt;br /&gt;Loop&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The pairs of double quotes inside the quoted string prevent "file not found" errors if the path contains spaces.  The Run method is documented &lt;a href="http://msdn2.microsoft.com/en-us/library/d5fk67ky.aspx"&gt;here&lt;/a&gt;, in case you want to change the window style (the second argument).</description>
      <pubDate>Sat, 18 Aug 2007 19:48:38 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4431</guid>
      <author>thinkulum (Andy Culbertson)</author>
    </item>
  </channel>
</rss>
