2

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?

3
  • No. Why would you need that? Commented 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. Commented 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? Commented Nov 23, 2017 at 13:43

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.