ノードjsを使用してexeを実行したかった。これは、コマンドが Windows のコマンド プロンプトでどのように見えるかです。
oplrun -D VersionId=3458 -de "output.dat" "Test.mod" "Test.dat"
これは正常に実行され、output.dat ファイルに出力が得られます。今、nodejsで同じことを実行したかったので、これにexecFileを使用しました。私が実行するとうまくいきます:
var execFile = require('child_process').execFile;
execFile('oplrun',['Test.mod','Test.dat'], function(err, data) {
if(err) {
console.log(err)
}
else
console.log(data.toString());
});
ただし、出力ファイルまたはバージョンをパラメーターとして渡したい場合、実行されず、エラーも発生しません。コードは次のとおりです。
var execFile = require('child_process').execFile;
var path ='D:\\IBM\\ILOG\SAMPLE\\output.dat';
execFile('oplrun', ['-de',path],['Test.mod','Test.dat'], function(err, data) {
if(err) {
console.log(err)
}
else
console.log(data.toString());
});
-D VersionId=1111 や -de output.dat などを渡す必要がある場合、どのようにパラメーターを渡すのですか。
ありがとう、アジト