<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How Can I Determine the Default Script Host on a Computer Before I Run a Script?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/27/how-can-i-determine-the-default-script-host-on-a-computer-before-i-run-a-script.aspx</link><description>Hey, Scripting Guy! I know that when I run a script I can use code to determine whether the script is running under WScript or CScript. What I can’t figure out is this: how can I determine the default script host on a computer before I run a script? </description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Determine the Default Script Host on a Computer Before I Run a Script?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/27/how-can-i-determine-the-default-script-host-on-a-computer-before-i-run-a-script.aspx#3546210</link><pubDate>Wed, 16 Jan 2013 10:48:31 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3546210</guid><dc:creator>Adrian</dc:creator><description>&lt;p&gt;On Windows 7, as pointed out before, there are 2 &amp;#39;open&amp;#39; command listed under HKEY_CLASSES_ROOT\VBSFile\Shell.&lt;/p&gt;
&lt;p&gt;&amp;#39;Open\Command&amp;#39; calls WScript.exe, &amp;#39;Open2\Command&amp;#39; calls CScript.&lt;/p&gt;
&lt;p&gt;As to which is the default script host, that&amp;#39;s determined by the default value in the key HKEY_CLASSES_ROOT\VBSFile\Shell key. &lt;/p&gt;
&lt;p&gt;Mine says Open2, ergo it uses CScript.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3546210" width="1" height="1"&gt;</description></item><item><title>re: How Can I Determine the Default Script Host on a Computer Before I Run a Script?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/27/how-can-i-determine-the-default-script-host-on-a-computer-before-i-run-a-script.aspx#3507371</link><pubDate>Wed, 04 Jul 2012 07:56:44 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3507371</guid><dc:creator>Antony Gibbs</dc:creator><description>&lt;p&gt;This doesn&amp;#39;t work on Windows 7, it always returns &amp;quot;WScript&amp;quot;&lt;/p&gt;
&lt;p&gt;C:\&amp;gt;cscript //h:wscript //s&lt;/p&gt;
&lt;p&gt;Microsoft (R) Windows Script Host Version 5.8&lt;/p&gt;
&lt;p&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/p&gt;
&lt;p&gt;Command line options are saved.&lt;/p&gt;
&lt;p&gt;The default script host is now set to &amp;quot;wscript.exe&amp;quot;.&lt;/p&gt;
&lt;p&gt;C:&amp;gt;&amp;quot;What is my default Scripting Host.vbs&amp;quot;&lt;/p&gt;
&lt;p&gt;C:&amp;gt;cscript //h:cscript //s&lt;/p&gt;
&lt;p&gt;Microsoft (R) Windows Script Host Version 5.8&lt;/p&gt;
&lt;p&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/p&gt;
&lt;p&gt;Command line options are saved.&lt;/p&gt;
&lt;p&gt;The default script host is now set to &amp;quot;cscript.exe&amp;quot;.&lt;/p&gt;
&lt;p&gt;C:&amp;gt;&amp;quot;What is my default Scripting Host.vbs&amp;quot;&lt;/p&gt;
&lt;p&gt;Microsoft (R) Windows Script Host Version 5.8&lt;/p&gt;
&lt;p&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/p&gt;
&lt;p&gt;WScript&lt;/p&gt;
&lt;p&gt;C:&amp;gt;&lt;/p&gt;
&lt;p&gt;Content of my vbs file is a copy &amp;amp; paste of your script above.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3507371" width="1" height="1"&gt;</description></item><item><title>re: How Can I Determine the Default Script Host on a Computer Before I Run a Script?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/27/how-can-i-determine-the-default-script-host-on-a-computer-before-i-run-a-script.aspx#3347985</link><pubDate>Mon, 02 Aug 2010 13:09:43 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3347985</guid><dc:creator>Martin</dc:creator><description>&lt;p&gt;This test works no longer under WSH 5.7.&lt;/p&gt;
&lt;p&gt;(see &lt;a rel="nofollow" target="_new" href="http://social.technet.microsoft.com/Forums/en/ITCG/thread/f0cc29fb-84a6-43b1-ae6e-8776faa8613b"&gt;social.technet.microsoft.com/.../f0cc29fb-84a6-43b1-ae6e-8776faa8613b&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Now there are two commands for VBSFile: Open for WScript.exe and Open2 for CScript.exe and the default value of HKCR\VBSFile\Shell\ is one of them.&lt;/p&gt;
&lt;p&gt;This seems to be a nasty breaking change because the WshShell.Run does not evaluate the default value of HKCR\VBSFile\Shell\ but instead always looks for the &amp;quot;Open&amp;quot; command which is now always WScript.exe.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3347985" width="1" height="1"&gt;</description></item></channel></rss>