force a vbscript to run in CSCRIPT

There are several valid reasons to demand that a vbscript runs in CSCRIPT instead of WSCRIPT, like for example to allow the use of Standard Input or to prevent a separate popup for each Wscript.Echo line.

The following code can be copied and pasted at the top of your own scripts to force them to run in CSCRIPT:

The code may look more complicated than necessary, that’s because it returns CSCRIPT‘s return code to the WSCRIPT engine, just in case this return code is monitored by the program that started the script in WSCRIPT.

In case you want to force a script to run in WSCRIPT instead, just substitute WSCRIPT.EXE for CSCRIPT.EXE.

Leave a Reply