We open the command prompt with administrator and change the location where you want to keep your js file as like this:

C:\node;

Let we go to create a simple program for Hello world in node.js. Here, where we want to store our file we create a test.js file and select through command prompt but here we select c:\node folder and code into test.js file:

var http = require('http');

http.createServer(function (req, res) {

res.writeHead(200, {'Content-Type': 'text/plain'});

res.end('Hello World\n');

}).listen(1337, "127.0.0.1");

console.log('Server running at http://127.0.0.1:1337/');

To run this program command prompt type the node filename.js

And run on the browser:

The output of the test.js file by node.js. I hope that this article is helpful for you.