You can redirect the output of CSCRIPT using `for /f` with the CSCRIPT
command line and parse its output. Or the output can be redirected into a
file first if a result file is needed.
e.g. the JS file part (test.js):
WScript.echo("Result from cscript");
The batch file part, with direct parsing, e.g.
@echo off
setlocal
set res=
for /f "delims=" %%A in ('cscript.exe //nologo test.js') do set "res=%%A"
echo result=%res%