node内置module

os

  1. const os = require('os');
  2. // 获取系统的版本
  3. const platform = os.platform()
  1. const os = require('os');
  2. const process = require('child_process');
  3. var cmd=require('node-cmd');
  4. const platform = os.platform()
  5. console.log(platform)
  6. if (platform.includes("win")) {
  7. process.exec("deploy.cmd", function (err, b, c) {
  8. console.log(err)
  9. })
  10. } else {
  11. console.log(2)
  12. }