我有在c#中的代碼工作正常,在我的UI自動化過程中在特定的服務器框中運行作業。我需要在節點js中的等效代碼。在節點js執行進程
ProcessStartInfo startinfo = new ProcessStartInfo();
startinfo.FileName = string.Format("schtasks.exe");
string command = string.Format(" /run /s {0} /tn \"{1}\"", "serverbox", "Jobname");
startinfo.Arguments = command;
startinfo.CreateNoWindow = true;//Not much important
startinfo.UseShellExecute = false;//Not much important
startinfo.WindowStyle = ProcessWindowStyle.Hidden;//Not much important
Common.Log.Info("Executing Command - " + command);
Process proc = new Process();
proc = Process.Start(startinfo);
我在node.js中有以下代碼引發「args選項的錯誤值」錯誤。
function executeProcess() {
var command = new String(" /run /s {0} /tn \"{1}\"", "serverbox", "jobname");
exec(command, function (err, stdout, stderr) {
console.log("Running job");
callback(err, stdout, stderr, data)
});
};
https://github.com/tjanczuk/edge –