How to use the Windows scripting host “//E” command line argument

command-line-argumentswsh

I am trying to use the windows scripting host command line argumet to run a .js file. However, everytime I run I get this error that it cannot find the script engine irrespective of providing absolute path or "wscript.exe" or just the name "wscript". I must use the "//E" option to to specify the script engine to use, to test something.

I tried "scriptfile.js //E:C:\Windows\System32\wscript", "scriptfile.js //E:C:\Windows\System32\wscript.exe" and "scriptfile.js //E:wscript" but nothing helps. It gives me the error "Can't find script engine C:\Windows\System32\wscript.exe" for script scriptfile.js"

Msdn links do not provide a sample command usage so it almost of no use to me, except that they inform me to check the spelling and the script engine – http://msdn.microsoft.com/en-us/library/s39f60wz(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/6kbz7235(v=vs.85).aspx

So if someone has successfully used the //E option to specify that "wscript" script engine needs to be used specifically, please do let me know.

Best Answer

I think the options for the //E: are either //E:jscript or //E:vbscript

Try:

wscript //E:jscript scriptfile.js

here's my attempt: enter image description here

you can type wscript /? on the command line to see the options.

enter image description here.