The (default) PATHEXT environment variable contains .vbs/.js/.wsf but wscript.exe is usually set as the default windows scripting engine host, so running scripts in a terminal is a big pain. What if we could put the WSH script inside a batch file so we don’t have to prefix every call with cscript //nologo ?
@if (1==1) @if(1==0) @ELSE
@echo off&SETLOCAL ENABLEEXTENSIONS
cscript //E:JScript //nologo "%~f0" %*
WScript.Echo("hello from WSH");
If there ever was a huge scripting hack, this is it. Somehow it is both “valid” BAT and JScript syntax! The @if syntax requires MS:JScript v3 (IE4+), on the batch side of things, %~f0 and %* requires at least NT4, maybe NT5.