How can I execute bat file from windows with credentials.
Checked this solution and just curious how to pass the credentials to login to unix server and then do some steps using bat file?
fs.chmodSync('./myFile.bat', 0o755);
let spawn = require('child_process').spawn,
ls = spawn('cmd.exe',["/c", `C:\\myFile.bat`], ["","\\data\\myFromFolder"] );
ls.stdout.on('stdout', function (error, stdout, stderr) {
if (error) {
console.error(error);
return;
}
console.log('stdout: ' + stdout);
});
Basically I need to pass parameters to the bat file. from the javascrpt code.
I set some default parameters in the .bat file, But the first three param has to be local folder path, username , password
Similar to this issue