node-eパラメータ

929 ワード

https://nodejs.org/api/cli.html#cli_e_eval_スクリプト
Evaluate the following argument as JavaScript. The modules which are predefined in the REPL can also be used in script.

On Windows, using cmd.exe a single quote will not work correctly because it only recognizes double " for quoting. In Powershell or Git bash, both ' and " are usable.

node-eは、jsスクリプトのセグメントを直接実行し、例えば、入力しても良いです.
 node -e 'console.log("a")'