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
i=(instrrev(ucase(WScript.FullName),"CSCRIPT")<>0)
returns -1 if running cscript, 0 if running wscript