How to tell the difference between a VBscript is run from command line or by clicking it in a window?

Posted by robbie on Stack Overflow See other posts from Stack Overflow or by robbie
Published on 2010-12-31T18:56:21Z Indexed on 2011/01/01 0:54 UTC
Read the original article Hit count: 195

Filed under:
|
|

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 C:\testFolder\test.vbs in a command prompt, then I want the program to run differently than if you double clicked test.vbs in the testFolder.

Is there some system variable that I can use to differentiate between the two scenarios? I first attempted to use WScript.Fullname to determine if the pathname ended in cscript or wscript. But that didn't work so well.

Any ideas are greatly appreciated.

© Stack Overflow or respective owner

Related posts about scripting

Related posts about command-line