Using the command dirin Windows CMD will result in the following output:
Verzeichnis von D:\workspace\filewalker
22.12.2013 17:27 <DIR> .
22.12.2013 17:27 <DIR> ..
22.12.2013 17:48 392 test.js
22.12.2013 17:23 0 testรถรครผรรร.txt
22.12.2013 17:27 <DIR> testรรรรถรผรคร
2 Datei(en), 392 Bytes
3 Verzeichnis(se), 273.731.170.304 Bytes frei
Using execor spawnwill result in the following:
Verzeichnis von D:\workspace\filewalker
22.12.2013 17:27 <DIR> .
22.12.2013 17:27 <DIR> ..
22.12.2013 17:48 392 test.js
22.12.2013 17:23 0 test .txt
22.12.2013 17:27 <DIR> test
2 Datei(en), 392 Bytes
3 Verzeichnis(se), 273.731.170.304 Bytes frei
Here is my Node Code:
var exec = require('child_process').exec,
child;
child = exec('dir',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
source
share