node 执行 bat 命令:乱码、路径问题

乱码

index.jsnode

const shell = require('shelljs');

shell.exec('aaa', function (code, stdout, stderr) {
});
复制代码

执行 node index 出现乱码shell

先执行chcp 65001便可ui

路径

在当前目录执行不能加./(powershell下执行须要加),下面这个会报错spa

shell.exec('./test', function (code, stdout, stderr) {
});
复制代码

这个报错彷佛很友好,但和乱码同时出现就很懵了。记念个人半个下午code

相关文章
相关标签/搜索