I have a VB Script in which I only want to display certain messages if I'm
running under CScript. I use WScript.Echo to display these messages. If the
script is running under WScript, it opens the message box and I have to hit
"OK" to continue, so if the script is running under WScript, I do not want to
display these messages.

I'm looking for a way, in the script, to tell if it is running under CScript
or WScript. Is there some property that tells me which program the script is
running under? If not, is there any other way to accomplish this?

Thanks

Re: How To Tell If Running CScript or WScript? by Brian

Brian
Thu Oct 06 00:59:01 CDT 2005

John Schneider wrote:
> I have a VB Script in which I only want to display certain messages if I'm
> running under CScript. I use WScript.Echo to display these messages. If the
> script is running under WScript, it opens the message box and I have to hit
> "OK" to continue, so if the script is running under WScript, I do not want to
> display these messages.
>
> I'm looking for a way, in the script, to tell if it is running under CScript
> or WScript. Is there some property that tells me which program the script is
> running under? If not, is there any other way to accomplish this?
>
> Thanks
>

Take a look at the wscript.fullname property, e.g.,

If (InStr(wscript.FullName,"cscript") > 0) Then
wscript.echo "cscript"
Else
wscript.echo "wscript"
End If

Re: How To Tell If Running CScript or WScript? by johnmsch

johnmsch
Thu Oct 06 09:22:02 CDT 2005

"Brian Wolven" wrote:

> John Schneider wrote:
> > I have a VB Script in which I only want to display certain messages if I'm
> > running under CScript. I use WScript.Echo to display these messages. If the
> > script is running under WScript, it opens the message box and I have to hit
> > "OK" to continue, so if the script is running under WScript, I do not want to
> > display these messages.
> >
> > I'm looking for a way, in the script, to tell if it is running under CScript
> > or WScript. Is there some property that tells me which program the script is
> > running under? If not, is there any other way to accomplish this?
> >
> > Thanks
> >
>
> Take a look at the wscript.fullname property, e.g.,
>
> If (InStr(wscript.FullName,"cscript") > 0) Then
> wscript.echo "cscript"
> Else
> wscript.echo "wscript"
> End If
>

Thanks Brian! I knew it was there somewhere!