I would like to have a console window (a command line) on Windows 7 which will allow me to play with JavaScript just like a python console.
Update: It's important to have a file access from within the console (or script run through it).
You can use Node.js's REPL. To do so follow this steps:
node.exe installation path (e.g C:\Program Files\nodejs\node.exe).You may want to add the installation path to your PATH enviroment variable for ease of use.
Note: to leave node.js press Ctrl + C twice.
To access the local files, you will need the File System module. This is an example of usage:
var fs = require("fs");
fs.readFile(
"C:\\test.txt",
function(err, data)
{
if (!err)
console.log(data.toString());
}
);
This will output the contents of the file C:\test.txt to the console.
Note: An unhandled exception will cause node.js to "crash".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With