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

前端 未结 3 1723
故里飘歌
故里飘歌 2020-12-11 06:32

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

3条回答
  •  旧巷少年郎
    2020-12-11 07:09

    i=(instrrev(ucase(WScript.FullName),"CSCRIPT")<>0)
    

    returns -1 if running cscript, 0 if running wscript

提交回复
热议问题