title: How to run a hello.js file in Node.js on windows?
body: <p>I am trying to run a hello world program written in javascript in a separate file named hello.js</p>
  
  <p>Currently running windows version of node.js.</p>
  
  <p>The code runs perfectly in console window but <strong>how do I reference the path in windows environment</strong>.</p>
  
  <pre><code>C:\abc\zyx\hello.js
  </code></pre>
  
  <p>in Unix I guess it is showing $ node hello.js</p>
  
  <p>I'm absolutely new to Node.js Please correct me if I am doing something wrong.</p>
  
  <p>I tried </p>
  
  <p><code>&gt; node  C:\abc\zyx\hello.js</code> ----didn't work</p>
  
  <p><code>&gt; C:\abc\zyx\hello.js</code> --didn't work</p>
  
  <p><strong>UPDATE1:</strong></p>
  
  <p>Added node.exe to the folder where hello.js file is sitting.<br>
  Added path point to the folder c:\abc\zyx\  and I get an error that says </p>
  
  <p>ReferenceError: hello is not defined</p>
  
  <p>see contents of hello.js </p>
  
  <pre><code>setTimeout(function() {
  console.log('World!');
  }, 2000);
  console.log('Hello');
  </code></pre>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>So far I have tried all these version and <strong>none of them seems to work</strong>.  May be I am doing something completely wrong.</p>
  
  <pre><code>&gt;node hello.js
  &gt;$ node hello.js
  &gt;node.exe hello.js
  &gt;node /hello.js
  &gt;node \hello.js
  &gt; \node \hello.js
  &gt; /node /hello.js
  &gt; C:\abc\xyz\node.exe C:\abc\xyz\hello.js
  &gt; C:\abc\xyz\node.exe C:/abc/xyz/hello.js
  &gt; hello.js
  &gt; /hello.js
  &gt; \hello.js
  &gt;node hello
  </code></pre>
  
  <p><strong>Refer to my file structure</strong></p>
  
  <pre><code>.
  ├── hello.js
  ├── node.exe
  └── paths.txt
  </code></pre>
  
  <p><strong>RESOLVED:</strong>
  Instead of running node.exe, try running in command prompt with the following option and it worked.</p>
  
  <pre><code>c:\&gt;node c:\abc\hello.js
  Hello
  World! (after 2 secs)
  </code></pre>