# Call External Application

**URL:** <https://forum.inductiveautomation.com/t/call-external-application/1821>\
**Category:** Ignition\
**Created:** [May 7, 2010, 1:30am UTC](https://forum.inductiveautomation.com/t/call-external-application/1821 "2010-05-07T01:30:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sorenrj](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@sorenrj](https://forum.inductiveautomation.com/u/sorenrj)\
**Post date:** [May 7, 2010, 1:30am UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/1 "2010-05-07T01:30:27Z")

</div>

I would like to call an external application (.bat file using the DOS prompt) using a button click in the Ignition vision module. I found the system.util.execute function but I’m unsure how to specify the “program” and “parameter” strings. Any suggestions?

Thanks.

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [May 7, 2010, 2:51am UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/2 "2010-05-07T02:51:44Z")

</div>

It’s been a while, but when I used it last, I remember doing it like this:

If I wanted to do the equivalent of typing this in the command prompt:

c:\script.bat -run=windowed

I’d set up the strings like this:

Program string: “c:\script.bat”  
Parameter string: “-run=windowed”

Then, just throw them in an array, and pass that array to the execute function.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![sorenrj](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@sorenrj](https://forum.inductiveautomation.com/u/sorenrj)\
**Post date:** [May 7, 2010, 4:51pm UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/3 "2010-05-07T16:51:39Z")

</div>

Thanks for your suggestion Kevin. I didn’t have much luck. Here is my code:

parray=[‘C:\SQLSync\Sync.bat’, ‘-run=windowed’]  
system.util.execute(parray)

I tried various versions of the ‘-run=windowed’ string but no luck. Do you suppose I need to make the program path ‘C:\windows\system32\cmd.exe’?

Cheers,  
Soren.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [May 7, 2010, 10:42pm UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/4 "2010-05-07T22:42:12Z")

</div>

I’ve been able to launch Windows executables using system.util.execute, but it doesn’t seem to do anything if you pass it a batch file.

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [May 7, 2010, 10:48pm UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/5 "2010-05-07T22:48:24Z")

</div>

I haven’t tried it, but what about using cmd.exe as the first string, and the path to the batch file as the second string?

---

<div class="post-metadata">

**Author:** ![sorenrj](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@sorenrj](https://forum.inductiveautomation.com/u/sorenrj)\
**Post date:** [May 7, 2010, 11:05pm UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/6 "2010-05-07T23:05:06Z")

</div>

Already tried the cmd.exe approach you suggested. Also no luck…

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [May 7, 2010, 11:42pm UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/7 "2010-05-07T23:42:46Z")

</div>

Googling showed me this might work:

cmd /C start C:/test.bat

So, if this does work,

string 1 is “c:\path\_to\cmd.exe”  
string 2 is “/C”  
string 3 is “start”  
and string 4 is “C:/test.bat”

In my trials at the command prompt, this worked.

Good luck!

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [May 8, 2010, 11:01am UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/8 "2010-05-08T11:01:24Z")

</div>

Well done Kevin ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")

I got it working with the following:`system.util.execute(["C:\windows\system32\cmd.exe","/C","start","C:\Test.bat","123","456"])`where 123 and 456 are 2 parameters being passed to the batch file.

Note that this will leave the cmd window open on the screen. To close it when you’re done, make sure you include an ‘exit’ command as the last line of your batch file.

---

<div class="post-metadata">

**Author:** ![sorenrj](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@sorenrj](https://forum.inductiveautomation.com/u/sorenrj)\
**Post date:** [May 10, 2010, 11:43pm UTC](https://forum.inductiveautomation.com/t/call-external-application/1821/9 "2010-05-10T23:43:44Z")

</div>

Excellent! Thanks all. Works like a charm.
