正如PSkocik所说,首先检测平台并获取命令行:
function getCommandLine() { switch (process.platform) { case 'darwin' : return 'open'; case 'win32' : return 'start'; case 'win64' : return 'start'; default : return 'xdg-open'; }}第二,执行命令行,然后输入路径
var exec = require('child_process').exec;exec(getCommandLine() + ' ' + filePath);


