# Launching an executable from a Gateway Startup Script

**URL:** <https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641>\
**Category:** General Discussion\
**Created:** [January 3, 2013, 8:14pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641 "2013-01-03T20:14:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [January 3, 2013, 8:14pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641/1 "2013-01-03T20:14:23Z")

</div>

I have an .exe that needs to run on the Gateway computer. I am trying to start the .exe from a Gateway Startup Script using

system.util.execute([“C:\Program Files (x86)\Seagull\BarTender Suite\bartend.exe”,"/F=C:\Users\admin\Documents\BarTender\BarTender Documents\Test.btw", “/MIN”])

The code works from a button event handler, and from a Client Timer Script, if the Ignition project is running on the server. It does not work from a Gateway Timer Script. Any ideas?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 3, 2013, 8:16pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641/2 "2013-01-03T20:16:51Z")

</div>

That software needs to be installed and in that location on the gateway machine if you’re going to run it from a gateway timer script. Is that the case?

Client timer scripts and button even handlers run on the machine running the client and designer.

---

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [January 3, 2013, 8:41pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641/3 "2013-01-03T20:41:55Z")

</div>

Yes that is the case. The only time the button or Client Timer Script work is if the Ignition project is running on the Gateway computer.

I have also tried placing a try…except in the code to see an error, but it seems to go through error free. It just doesn’t launch the program.

---

<div class="post-metadata">

**Author:** ![thechtman](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@thechtman](https://forum.inductiveautomation.com/u/thechtman)\
**Post date:** [January 3, 2013, 8:55pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641/4 "2013-01-03T20:55:44Z")

</div>

The Ignition service runs under a different account and session than the interactive user. Typically, Ignition runs under the local system account in session 0.

Look at the Microsoft psexec utility that will allow specifying the account and session to run a program with.

---

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [January 3, 2013, 9:40pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641/5 "2013-01-03T21:40:49Z")

</div>

I’m not familiar with this. I’ll do my homework and post a reply.

---

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [January 3, 2013, 11:19pm UTC](https://forum.inductiveautomation.com/t/launching-an-executable-from-a-gateway-startup-script/5641/6 "2013-01-03T23:19:52Z")

</div>

In working on the psexec utility I found that my original program was starting the process in the background under the SYSTEM user.

Thanks for pointing me in the right direction.
