Skip to content

Instantly share code, notes, and snippets.

@edysegura
Last active August 29, 2015 14:22
Show Gist options
  • Save edysegura/ad786f2cb7452ea6e6be to your computer and use it in GitHub Desktop.
Save edysegura/ad786f2cb7452ea6e6be to your computer and use it in GitHub Desktop.
[nodejs] How to pass command line arguments to Node.js? https://nodejs.org/docs/latest/api/process.html#process_process_argv
// print process.argv
process.argv.forEach(function(val, index, array) {
console.log(index + ': ' + val);
});
//$ node process.js one two=three four
//0: node
//1: /Users/mjr/work/node/process-2.js
//2: one
//3: two=three
//4: four
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment