Login  Register

Re: Execute Windows cmd commands within macro language

Posted by Gabriel Landini on Oct 26, 2017; 11:32am
URL: http://imagej.273.s1.nabble.com/Execute-Windows-cmd-commands-within-macro-language-tp5019610p5019611.html

On Thursday, 26 October 2017 12:25:09 BST  Gregory James wrote:

> I would like to execute two lines of Windows cmd commands within the macro
> language.
>
> Specifically, I want to execute the following two commands...
>
> cd C:Program Files\ImageJ\plugins\CHT Clinical Programs\DICOM Export
> storescu -v 10.139.228.187 104 C:\_Temp\SecondaryCapture.dcm -aec XELERIS3
>
> At the moment I am executing these commands with a .bat file that sits on my
> desktop but it would be great if I could do this within the macro language.

Have a look in the Macro Functions pages:

exec(string or strings)

Executes a native command and returns the output of that command as a string.
Also opens Web pages in the default browser and documents in other
applications (e.g., Excel). With commands with multiple arguments, each
argument should be passed as a separate string. For example
   exec("open", "/Users/wayne/test.jpg", "-a", "/Applications/Gimp.app");
Refer to the ExecExamples macro for examples.

Hope it helps.
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html