Is there any way to kick off a javascript file from the windows command line that doesn't involve node.js or any other package of that ilk?
-
No. Why would you need that?Zlatan Omerovic– Zlatan Omerovic2017-11-23 11:58:52 +00:00Commented Nov 23, 2017 at 11:58
-
hm, you need a JS engine - such as V8 which is used by node - and at least some APIs / standard libraries which allow you to read / write / interact with the command line. Which is what node offers.le_m– le_m2017-11-23 11:59:57 +00:00Commented Nov 23, 2017 at 11:59
-
The reason I ask is that I've done a test for a job application which involves a javascript program. The instructions say to write a command line utility. My thinking was that as you can kick off a JS program with node, that in itself counts as a clu. However, it turns out I'm an idiot and they want an actual clu to kick off the program. Now to my mind that means they're after a good old fashioned dos batch file but they would still need to have node or something similar installed. Am I right? Or am I even stupider than I thought?Patrick– Patrick2017-11-23 13:43:49 +00:00Commented Nov 23, 2017 at 13:43
Add a comment
|
1 Answer
You need a JavaScript environment to run a JavaScript file from the command line. Node.js is the most popular environment, and I'd advise using that.
However there are alternatives tools which can convert the JavaScript file into another language which can then be ran locally, such as Rhino or SpiderMonkey.
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino
Another method to run JavaScript code is to open the development console in your browser, and copy the code into that.