Re: Scripting hosts backwards on my system
- From: JJ <jim.mcatee@xxxxxxxxx>
- Date: Sat, 12 Jul 2008 17:20:13 -0700 (PDT)
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
.
- Follow-Ups:
- Re: Scripting hosts backwards on my system
- From: Al Dunbar
- Re: Scripting hosts backwards on my system
- References:
- Scripting hosts backwards on my system
- From: JJ
- Re: Scripting hosts backwards on my system
- From: Al Dunbar
- Re: Scripting hosts backwards on my system
- From: Todd Vargo
- Scripting hosts backwards on my system
- Prev by Date: Re: Scripting hosts backwards on my system
- Next by Date: Re: Modify a .doc document with a macro without Word ?
- Previous by thread: Re: Scripting hosts backwards on my system
- Next by thread: Re: Scripting hosts backwards on my system
- Index(es):
Relevant Pages
|