Has anyone seen this before? I'm not sure what exactly is backwards.
Is it just the //h: arguments to cscript and wscript?

I created a one line script call whichscript.vbs, with only
'WScript.Echo WScript.FullName' in it. Then did the following at a
command prompt:

----------------------------------------------------------------------------------------
C:\>cscript //h:cscript
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

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

C:\>whichscript.vbs

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

C:\>cscript //h:wscript
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

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

C:\>whichscript.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

C:\WINDOWS\System32\CScript.exe
----------------------------------------------------------------------------------------

Re: Scripting hosts backwards on my system by Al

Al
Sat Jul 12 11:24:57 CDT 2008


"JJ" <jim.mcatee@gmail.com> wrote in message
news:6fdd1a96-2beb-4970-8d61-ab3b2f701e9a@k30g2000hse.googlegroups.com...
> Has anyone seen this before? I'm not sure what exactly is backwards.
> Is it just the //h: arguments to cscript and wscript?
>
> I created a one line script call whichscript.vbs, with only
> 'WScript.Echo WScript.FullName' in it. Then did the following at a
> command prompt:
>
> ----------------------------------------------------------------------------------------
> C:\>cscript //h:cscript
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> The default script host is now set to "cscript.exe".
>
> C:\>whichscript.vbs
>
> (This pops up an interactive window saying 'C:\WINDOWS
> \System32\CScript.exe')
>
> C:\>cscript //h:wscript
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> The default script host is now set to "wscript.exe".
>
> C:\>whichscript.vbs
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> C:\WINDOWS\System32\CScript.exe
> ----------------------------------------------------------------------------------------

I've never used that feature myself, but don't you need to include the //S
switch to "save current command line options for this user"?

/Al



Re: Scripting hosts backwards on my system by Todd

Todd
Sat Jul 12 14:31:10 CDT 2008

Al Dunbar wrote:
> JJ wrote:
> > Has anyone seen this before? I'm not sure what exactly is backwards.
> > Is it just the //h: arguments to cscript and wscript?
> >
> > I created a one line script call whichscript.vbs, with only
> > 'WScript.Echo WScript.FullName' in it. Then did the following at a
> > command prompt:
> >
>
> --------------------------------------------------------------------------
--------------
> > C:\>cscript //h:cscript
> > Microsoft (R) Windows Script Host Version 5.7
> > Copyright (C) Microsoft Corporation. All rights reserved.
> >
> > The default script host is now set to "cscript.exe".
> >
> > C:\>whichscript.vbs
> >
> > (This pops up an interactive window saying 'C:\WINDOWS
> > \System32\CScript.exe')
> >
> > C:\>cscript //h:wscript
> > Microsoft (R) Windows Script Host Version 5.7
> > Copyright (C) Microsoft Corporation. All rights reserved.
> >
> > The default script host is now set to "wscript.exe".
> >
> > C:\>whichscript.vbs
> > Microsoft (R) Windows Script Host Version 5.7
> > Copyright (C) Microsoft Corporation. All rights reserved.
> >
> > C:\WINDOWS\System32\CScript.exe
>
> --------------------------------------------------------------------------
--------------
>
> I've never used that feature myself, but don't you need to include the //S
> switch to "save current command line options for this user"?

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.

The //S switch is for saving other switches, for example //B or //NoLogo
that would be included at runtime of a script. //S would cause these
switches to "stick" so you would not need to include them every time a
script is run at the prompt.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)


Re: Scripting hosts backwards on my system by JJ

JJ
Sat Jul 12 19:20:13 CDT 2008

On Jul 12, 1:31=A0pm, "Todd Vargo" <tlva...@sbcglobal.netz> 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 comma=
nd
> 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:

---------------------------------------------------------------------------=
=AD-------------
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')
---------------------------------------------------------------------------=
=AD-------------


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) =3D 0
Then
Dim msg
msg =3D "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

Re: Scripting hosts backwards on my system by Al

Al
Sun Jul 13 12:09:11 CDT 2008


"JJ" <jim.mcatee@gmail.com> wrote in message
news:ea44c2bc-c7d5-4cf5-98e4-abe63671c3bd@l64g2000hse.googlegroups.com...
On Jul 12, 1:31 pm, "Todd Vargo" <tlva...@sbcglobal.netz> 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

===> another solution you might find useful, considering your scripts are
already testing to see which engine they are running under, would be to
replace the code above that displays the message advising to use cscript
with code that launches the same script with the same parameters using
cscript.exe.

/Al



Re: Scripting hosts backwards on my system by Todd

Todd
Sun Jul 13 13:27:31 CDT 2008

Al Dunbar wrote:
>
> On Jul 12, 1:31 pm, "Todd Vargo" <tlva...@sbcglobal.netz> 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:

My bad. Win95Cmd confirms it worked from command line as well. OP's post
indicated "Version 5.7" so it may be a bug introduced in Vista.

>
> ===> another solution you might find useful, considering your scripts are
> already testing to see which engine they are running under, would be to
> replace the code above that displays the message advising to use cscript
> with code that launches the same script with the same parameters using
> cscript.exe.

Agreed.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)


Re: Scripting hosts backwards on my system by JJ

JJ
Mon Jul 14 01:25:17 CDT 2008

On Jul 13, 12:27=A0pm, "Todd Vargo" <tlva...@sbcglobal.netz> wrote:

> > No, in the past it's always switched it for CMD as well, and it
> > appears to work correctly on my Win2k3 Server system:
>
> My bad. Win95Cmd confirms it worked from command line as well. OP's post
> indicated "Version 5.7" so it may be a bug introduced in Vista.

XP Pro with Service Pack 3.

Re: Scripting hosts backwards on my system by Todd

Todd
Mon Jul 14 16:01:28 CDT 2008

JJ wrote:
> On Jul 13, 12:27 pm, "Todd Vargo" <tlva...@sbcglobal.netz> wrote:
>
>>> No, in the past it's always switched it for CMD as well, and it
>>> appears to work correctly on my Win2k3 Server system:
>>
>> My bad. Win95Cmd confirms it worked from command line as well. OP's
>> post indicated "Version 5.7" so it may be a bug introduced in Vista.
>
> XP Pro with Service Pack 3.

That may be the problem. See "Why Version 5.7?" here...

Windows Script 5.7 Release Notes
http://tinyurl.com/17a

Microsoft needs to add a Oops section. ;-)

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)


Re: Scripting hosts backwards on my system by Michael

Michael
Mon Jul 14 22:28:36 CDT 2008

JJ wrote:
> Has anyone seen this before? I'm not sure what exactly is backwards.
> Is it just the //h: arguments to cscript and wscript?
>
> I created a one line script call whichscript.vbs, with only
> 'WScript.Echo WScript.FullName' in it. Then did the following at a
> command prompt:
>
> ----------------------------------------------------------------------------------------
> C:\>cscript //h:cscript
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> The default script host is now set to "cscript.exe".
>
> C:\>whichscript.vbs
>
> (This pops up an interactive window saying 'C:\WINDOWS
> \System32\CScript.exe')
>
> C:\>cscript //h:wscript
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> The default script host is now set to "wscript.exe".
>
> C:\>whichscript.vbs
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> C:\WINDOWS\System32\CScript.exe
> ----------------------------------------------------------------------------------------

This is a known problem described here...

Windows Script 5.7: Scripting News
<http://www.microsoft.com/technet/scriptcenter/newswire/wsh57.mspx>

--
Michael Harris