All I want to do is differentiate between the program being run by the command line or by clicking the test.vbs file in a window.
If you run the script by typing
If you want to test against WScript.FullName
, you can use InStr
with vbTextCompare
so that the match is case-insensitive.
If InStr(1, WScript.FullName, "cscript", vbTextCompare) Then
WScript.Echo "Console"
ElseIf InStr(1, WScript.FullName, "wscript", vbTextCompare) Then
WScript.Echo "Windows"
Else
WScript.Echo "???"
End If