ok-engineering.net
  • タグ: バッチ

    検索結果: 1件

    article-thumbnail

    Node.jsでコマンドラインの引数を取得する方法

    【概要】 Node.jsでコマンドライン実行時に引数を設定した場合にその引数を取得する方法をまとめます。【詳細】1. コマンド例「1」と「1000」という2つの引数を設定して実行します。node index.js 1 10002. index.jsで引数を確認する「process.argv」に引数が格納される為、log出力します。console.log(process.argv);3. 出力結果例配列の1・2番目には実行するNode.jsと実行したファイル名が入ります。よって、引数に設定した値が入るのは3番目からになります。[ '/usr/local/Cellar/node/14.6.0/bin/node', '/Users/hoge/Documents/hogeProject/index.js', '1', '1000']

    カテゴリ: Node.js 2020-09-10 00:12:56
    カテゴリ一覧
    1. CentOS23posts
    2. mac15posts
    3. MySQL12posts
    4. Nuxt.js11posts
    5. JS11posts
    6. Linux10posts
    7. Node.js8posts
    8. NGINX7posts
    9. Git5posts
    10. PHP4posts
    11. Redis3posts
    12. GCP2posts
    13. AWS2posts
    14. jQuery2posts
    15. CakePHP1posts
    16. Docker1posts
    17. ZABBIX1posts
    18. CSS1posts
    19. Windows1posts
    © 2020 Copyright: ok-engineering.net