how to run a multi-line command line or a .bat file in scripting
has tried Process.execute(cmd1 & cmd2) failed
how to run a multi-line command line or a .bat file in scripting
-
- Newbie
- Posts: 2
- Joined: Sun Aug 14, 2022 6:39 am
Re: how to run a multi-line command line or a .bat file in scripting
If the batch file is fixed
Not tested! If the contents are variable you will have to write a temporary batch file of course.
I strongly advise against doing this in legacy scripting. It is just as easy to do this in Node.js. The package that I use for running external commands is execa (https://www.npmjs.com/package/execa).
Code: Select all
var batchFile = "E:\\path\\to\\batchfile.bat";
var processOptions = ["cmd","/C",batchFile];
var result = Process.execute(processOptions);
Code: Select all
var batchFilePath = job.createPathWithName(job.getNameProper()+".bat";
-
- Newbie
- Posts: 2
- Joined: Sun Aug 14, 2022 6:39 am
Re: how to run a multi-line command line or a .bat file in scripting
Yess.. thank you very much it is working