Re: Scripting hosts backwards on my system



On Jul 12, 1:31 pm, "Todd Vargo" <tlva...@xxxxxxxxxxxxxx> wrote:

No, the //H switch sets the default host which will be used when a script is
double clicked in Explorer. Apparently, typing a script name at the command
prompt invokes cscript.exe because CMD is not Explorer.

No, in the past it's always switched it for CMD as well, and it
appears to work correctly on my Win2k3 Server system:

---------------------------------------------------------------------------­-------------
G:\>cscript //h:cscript
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

The default script host is now set to "cscript.exe".

G:\>whichscript.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\WINDOWS\System32\CScript.exe

G:\>cscript //h:wscript
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

The default script host is now set to "wscript.exe".

G:\>whichscript.vbs

(This pops up an interactive window saying 'C:\WINDOWS
\System32\CScript.exe')
---------------------------------------------------------------------------­-------------


What's happening that first made me realize something is wrong is that
I always include a check to be sure that my scripts are running under
CScript. These checks were failing, even though CScript was long ago
made the default scripting host.

' See that we're running under the CSCript host. Exit if not.
'
Sub CheckCScript
If InStr(1, WScript.FullName, "cscript.exe", vbTextCompare) = 0
Then
Dim msg
msg = "This script must be run under the CScript (non-interactive)
script host." & vbCrLf & vbCrLf & _
"To make CScript the default host, enter the following at a
command" & vbCrLf & _
"prompt:" & vbCrLf & vbCrLf & _
"cscript //h:cscript"
MsgBox msg, vbOKOnly + vbExclamation, "Error"
WScript.Quit(1)
End If
End Sub
.



Relevant Pages

  • RE: VBScript in SQL Server Agent/Jobs not working
    ... Basically, Windows Scripting Host has two script calling executibles, WScript ... the .VBS or .JS extension and call it with WScript or CScript. ...
    (microsoft.public.sqlserver.server)
  • Re: ouput 100 lines from .wsf when using WScript
    ... > Hi Rob, ... > If they just need to see a list, I'd suggest using CScript, just create ... CScript as my default host. ... This script Torgeir hyperlinks to contains just what I needed. ...
    (microsoft.public.scripting.wsh)
  • Re: Scripting hosts backwards on my system
    ... the //H switch sets the default host which will be used when a script ... Copyright Microsoft Corporation 1996-2001. ... even though CScript was long ago ...
    (microsoft.public.scripting.vbscript)
  • Re: internet proxy
    ... Is it possible to create separate shortcuts to IE - one with 'proxy server ... This script gets used when you enable the "Automatically ... connect to the host so no proxy would get used. ...
    (microsoft.public.windowsxp.general)
  • Re: How do I insert a cgi script into Publisher page?
    ... is not where I host my website. ... If your ISP supports cgi and has a form handling program then a form ... You must tell the server what e mail address you want the form results ... any where else you so desire or an auto redirect script with a delay. ...
    (microsoft.public.publisher.webdesign)