Created
April 10, 2014 09:09
-
-
Save JackieLin/10359882 to your computer and use it in GitHub Desktop.
show Windows system letter using node.js
This file contains hidden or 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
var exec = require('child_process').exec; | |
// show Windows letter, to compatible Windows xp | |
function showLetter(callback) { | |
var wmicResult; | |
var command = exec('wmic logicaldisk get caption', function(err, stdout, stderr) { | |
if(err || stderr) { | |
console.log("root path open failed" + err + stderr); | |
return; | |
} | |
wmicResult = stdout; | |
}); | |
command.stdin.end(); // stop the input pipe, in order to run in windows xp | |
command.on('close', function(code) { | |
console.log("wmic close:: code:" + code); | |
var data = wmicResult.split('\n'), result = {}; | |
callback(result); | |
}); | |
} | |
/** | |
* output: | |
* Caption | |
* C: | |
* D: | |
* E: | |
* F: | |
* G: | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment