DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Automatically Restarting An Application In Windows
This script will start a program and automatically relaunch it if it closes. It's a stripped down version of the script in <a href="http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9635">JSI Tip 9635: How can I start an application, and automatically restart it if the user ends it?</a>.
Set WshShell = CreateObject("WScript.Shell") Do While True WshShell.Run """<the path to the executable file>""", 1, True Loop
The pairs of double quotes inside the quoted string prevent "file not found" errors if the path contains spaces. The Run method is documented <a href="http://msdn2.microsoft.com/en-us/library/d5fk67ky.aspx">here</a>, in case you want to change the window style (the second argument).