node.js中没有api来列出分区.一种解决方法是使用child_process并执行wmic命令(或任何可以列出分区的命令).
原文链接:https://www.f2er.com/windows/364313.htmlvar spawn = require('child_process').spawn,list = spawn('cmd'); list.stdout.on('data',function (data) { console.log('stdout: ' + data); }); list.stderr.on('data',function (data) { console.log('stderr: ' + data); }); list.on('exit',function (code) { console.log('child process exited with code ' + code); }); list.stdin.write('wmic logicaldisk get name\n'); list.stdin.end();