07-24-2023, 09:57 AM
I've got a .js file that's meant to be executed by Node.js on the command-line. I've got everything set up with `npm` and such to put the file into the user's path as a "bin". My problem is, because the file ends in .js, running it from the command line is shipping it off to the JScript-based Windows Script Host, instead of node, as expected.
I'm trying to write a JScript wrapper, to sit at `myprogram.js`, be executed by Windows Script Host, and ship off to Node.js. Unfortunately, it doesn't seem like WScript's `Exec` command behaves like the UNIX exec command:
var shell = new ActiveXObject("WScript.Shell");
var proc = shell.exec("node .\\Library\\executable.js");
while (proc.Status === 0) {
WScript.Sleep(100);
}
WScript.Echo(proc.Status);
This buffers the program's output, and exposes it via some sort of JScript `WshScriptExec` object.
I need a script, or a feature, or some other way, to hand *the entire terminal* over to the command-line script I'm launching. Most usefully, I'd like to replace the JScript process that's executing, with the process for the command that I'm executing (i.e. UNIX-`exec`-y behaviour.) Is there any way to do this, or some other way to solve my problem?
I'm trying to write a JScript wrapper, to sit at `myprogram.js`, be executed by Windows Script Host, and ship off to Node.js. Unfortunately, it doesn't seem like WScript's `Exec` command behaves like the UNIX exec command:
var shell = new ActiveXObject("WScript.Shell");
var proc = shell.exec("node .\\Library\\executable.js");
while (proc.Status === 0) {
WScript.Sleep(100);
}
WScript.Echo(proc.Status);
This buffers the program's output, and exposes it via some sort of JScript `WshScriptExec` object.
I need a script, or a feature, or some other way, to hand *the entire terminal* over to the command-line script I'm launching. Most usefully, I'd like to replace the JScript process that's executing, with the process for the command that I'm executing (i.e. UNIX-`exec`-y behaviour.) Is there any way to do this, or some other way to solve my problem?