-
-
Save meteormatt/8234385 to your computer and use it in GitHub Desktop.
模拟Windows命令行
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var iconv = require('iconv-lite'); | |
var exec = require('child_process').exec; | |
var child = exec('dir', function (error, stdout, stderr) { | |
var str = iconv.encode(stdout, 'GBK'); | |
console.log('stdout: ' + str); | |
// console.log('stdout: ' + stdout); | |
console.log('stderr: ' + stderr); | |
if (error !== null) { | |
console.log('exec error: ' + error); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment