nodejsはcmd、shell命令を実行します.
379 ワード
var exec = require('child_process').exec;
function execute(cmd){
exec(cmd, function(error, stdout, stderr) {
if(error){
console.error(error);
}
else{
console.log("success");
}
});
}
execute('del .\\aaa\\aaa.txt');
execute('copy .\\aaaa\\aaa.txt .\\aaa');