title: Node.js command line tool opens in notepad instead of being executed
body: <p>I try to create a simple node.js command line tool to get around this concept. I am following this <a href="https://developer.atlassian.com/blog/2015/11/scripting-with-node/" rel="nofollow noreferrer">tutorial</a>. Using <code>npm init</code>, I have created a project named <code>lb-model-discovery</code>. This is the content of the package.json</p>
  
  <pre><code>{
    "name": "lb-model-discovery",
    "version": "1.0.0",
    "description": "loopback model discovery command line tool",
    "main": "index.js",
    "bin" :{
        "lb-discover":"./index.js"
    },
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
    },
    "author": "seya obey",
    "license": "ISC"
  }
  </code></pre>
  
  <p>And this is the (very simple) content of the <code>index.js</code> at the root of the project:</p>
  
  <pre><code>console.log('hello world');
  </code></pre>
  
  <p>After that I executed this command from within the folder (as suggested by the above tutorial):</p>
  
  <pre><code>npm install -g
  </code></pre>
  
  <p>This correctly install my tool as a global node command line module. Going into the global repository of node modules in my system (windows), I can see that this is the file created in the npm folder: <code>lb-discover.cmd</code>. And here is its content:</p>
  
  <pre><code>@"%~dp0\node_modules\lb-model-discovery\index.js"   %*
  </code></pre>
  
  <p>But now when I run my new tool from the command line prompt:</p>
  
  <pre><code>$ lb-discover
  </code></pre>
  
  <p>instead of displaying a "Hello world" message in the console, it opens notepad instead and merely display the content of the index.js file.</p>
  
  <p>What am I doing wrong? How can I execute my custom node.js command line?</p>
  
  <p>Any help would be greatly appreciated.</p>