Working with JScript file on Vista box  , did noticed diffrence where bWaitOnReturn property is not working as expected.

Syntax 
   WshShell.Run (strCommand, [intWindowStyle], [bWaitOnReturn]) 

   bWaitOnReturn : Wait for the command to complete before
                   continuing execution of the wsh script.

If bWaitOnReturn is set to TRUE, the Run method returns any error code returned by the application.
If bWaitOnReturn is not specified or FALSE, this method immediately returns to script execution rather than waiting on the process termination (and returns an error code of 0)

 

Steps to reproduce
===============

1) Create a test.js with following code

var WshShell = WScript.CreateObject("WScript.Shell");

              WshShell.Run("notepad.exe", 1, true);

2) Create a test.vbs with following code

                   Set WshShell = WScript.CreateObject("WScript.Shell")

              Return = WshShell.Run("notepad.exe", 1, true)

When executing(double click) test.js on  XP, win2k3 , we see command prompt widow waiting till we close the notepad.

But on Vista box we don’t get command prompt window waiting.

Issue seems to be only with .JS file and not with .VBS file 

After research conclude it has nothing to do with behavior for WshShell.Run.The implementation of WScript.Shell is the same (in wshom.dll), no matter if your calling it from js or vbs.

The default settings for both .js and .vbs on all OS’s is to run scripts in wscript (no console). This can be changed to run scripts in cscript (with console)

To change default host environment from WScript to CScript. Using either the wscript or cscript command with the //H:cscript option resets the default for the current command window.

To make a permanent change run with //s switch

cscript //h:cscript //s

 

That resolved the issue !!! Smile