Converting javascript to exe, WScript was not declared
We have one javascript
that I would like to compile with exe
.
I am using jsc.exe
for this. However, when I try to compile, I get the following error.
error JS1135: Variable 'WScript' has not been declared
Here is the code segment:
var omgShell = WScript.CreateObject( "WScript.Shell" );
What is the problem?
thank
source to share
WScript is a variable that is not available in the context of jsc.exe. See this post for details .
In your case, just use var omgShell = new ActiveXObject("WScript.Shell");
and replace all references to WScript
byomgShell
or just do var WScript = new ActiveXObject("WScript.Shell");
source to share