I am trying to run cmd commands throung my javascript code. Here's my code
var process = require('child_process');
process.exec('ipconfig',function (err,stdout,stderr) {
if (err) {
console.log("\n"+stderr);
} else {
console.log(stdout);
}
});
and when I run ipconfig it runs and shows all ip configuartions but when I run ls to show files on my directory it gives me error
'ls' is not recognized as an internal or external command,
operable program or batch file.
In a Windows console, ls
is not a command. Try using dir
instead.