My prog.js
looks like this:
var WshShell = WSH.CreateObject("WScript.Shell");
var env = WshShell.Environment("PROCESS");
WSH.Echo(env.Length); // 46
WSH.Echo(env("OS")); // Windows_NT
WSH.Echo(env.Item("OS")); // Windows_NT
Output:
> cscript /nologo prog.js
46
Windows_NT
Windows_NT
How do I print all 46 environment variables? I've tried env.Item(0)
, env.Item(1)
, but they are empty strings.