cscript sometimes fails to run JScript

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi

I have written a JScript that I execute under cscript from the Windows
cmd line. It runs fine on my PC which runs Windows XP SP2 and WSH
version 5.6.

However, if I run it on a colleague's PC with the same XP and WSH
builds, the script runs only about 3 out of 4 tries. When it fails no
code in the script executes and no error is displayed. To demonstrate
this I tried running a script 'MyScript.js' containing only the line:

WScript.StdOut.WriteLine("Started!");

Here is a snippet of the cmd window showing successive runs:

C:\Work>cscript MyScript.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Started!

C:\Work>cscript MyScript.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Started!

C:\Work>cscript MyScript.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.


C:\Work>cscript MyScript.js
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Started!

As you can see, on one occasion the script did not execute at all.

If I use the //D switch, I always see an "Access is denied" message.

C:\Work>cscript MyScript.js //D
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

CScript Error: Initialization of the Windows Script Host failed.
(Access is denied. )

Please can anyone suggest what is causing the script not to run?

David


.



Relevant Pages

  • Re: Vbs path , how to run any where
    ... Microsoft Windows Script Host Version 5.6 ... Copyright Microsoft Corporation 1996-2001. ... Invoke your script like so: ... it can be invoked directly from the command prompt (without a specific ...
    (microsoft.public.scripting.wsh)
  • Re: Vbs path , how to run any where
    ... Microsoft Windows Script Host Version 5.6 ... Copyright Microsoft Corporation 1996-2001. ... Invoke your script like so: ... it can be invoked directly from the command prompt (without a specific ...
    (microsoft.public.scripting.wsh)
  • Sharing Violation with xcopy -after adsutil.vbs APPUNLOAD & iis st
    ... files to the web server and keep getting sharing violation. ... xcopy filename1.dll destdir ... Microsoft Windows Script Host Version 5.6 ... Copyright Microsoft Corporation 1996-2001. ...
    (microsoft.public.inetserver.iis)
  • Re: cscript sometimes fails to run JScript
    ... I have written a JScript that I execute under cscript from the Windows ... Microsoft Windows Script Host Version 5.6 ... Copyright Microsoft Corporation 1996-2001. ... CScript Error: Initialization of the Windows Script Host failed. ...
    (microsoft.public.scripting.wsh)
  • Re: adding disclaimer with visual basic SMTP transport event sink
    ... Microsoft Windows Script Host Version 5.6 ... Copyright Microsoft Corporation 1996-2001. ... Binding Display Name Specified: SMTPScriptingHost ...
    (microsoft.public.exchange.admin)