通过node.js打开快捷方式(.lnk)时出现问题。我应该怎么打开它?



var exec = require('child_process').execFile;

var runLibreOffice =function(){
    exec('D:\\Downloads\\bot\\botgo.lnk', function(err, data) {
        console.log(err)
        console.log(data.toString());
    });
}
runLibreOffice();

最佳答案

也许使用Windows快捷方式,您可以读取并执行.exe到快捷方式中。

https://www.npmjs.com/package/windows-shortcuts

ws.query("C:/ProgramData/Microsoft/Windows/Start Menu/Windows Update.lnk", console.log);

/* From console:
null { expanded:
   { args: 'startmenu',
     workingDir: 'C:\\Windows\\system32',
     icon: 'C:\\Windows\\system32\\wucltux.dll' },
  target: '%windir%\\system32\\wuapp.exe',
  args: 'startmenu',
  workingDir: '%windir%\\system32',
  runStyle: 1,
  icon: '%windir%\\system32\\wucltux.dll',
  iconIndex: '0',
  hotkey: 0,
  desc: 'Delivers software updates and drivers, and provides automatic updating options.' }
*/

09-25 18:18
查看更多