# System.util.execute not working

**URL:** <https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition80\
**Created:** [June 8, 2021, 5:56pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569 "2021-06-08T17:56:37Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbranson](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@sbranson](https://forum.inductiveautomation.com/u/sbranson)\
**Post date:** [June 8, 2021, 5:56pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/1 "2021-06-08T17:56:37Z")

</div>

I can’t get system.util.execute to do anything. When I run system.util.execute([‘notepad.exe’, ‘c:\program files\inductive automation\ignition\license.txt’]) like the example I don’t get any errors but nothing happens. I made sure that the “Allow service to interact with desktop” option was checked. I also made sure that the file existed using system.file.fileExists() and it returned true. What am I doing wrong?

---

<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:** [June 8, 2021, 5:58pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/2 "2021-06-08T17:58:18Z")

</div>

Because Ignition runs as a service I don't think it's possible for code running in gateway scope (tags, perspective) to open a GUI window even with "interact with desktop" enabled.

> [@Interacting with desktop](http://forum.inductiveautomation.com/t/interacting-with-desktop/44443/4):
>
> My understanding is that this isn’t possible since Windows 7. Even when you change the user the service runs as and check “allow interaction with desktop” it still runs in session 0 where it will not be seen. These changes simply allow the process to be started without failing so that legacy applications relying on the behavior don’t crash.

---

<div class="post-metadata">

**Author:** ![sbranson](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@sbranson](https://forum.inductiveautomation.com/u/sbranson)\
**Post date:** [June 8, 2021, 6:04pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/3 "2021-06-08T18:04:25Z")

</div>

this might be redundant but would it be possible to run a .py file from the execute command (its python 3.6) if it isn’t opening anything

---

<div class="post-metadata">

**Author:** ![tom.prodehl](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tom.prodehl/32/22713_2.png) [@tom.prodehl](https://forum.inductiveautomation.com/u/tom.prodehl)\
**Post date:** [June 8, 2021, 6:13pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/4 "2021-06-08T18:13:35Z")

</div>

My experience outside of Ignition with running .py files from within a service is that they run fine, you just, as stated, won’t see anything on the display.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 9, 2021, 3:12am UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/5 "2021-06-09T03:12:20Z")

</div>

The other issue here, of course, is that notepad would open (if this indeed did work) on the gateway server, not the client, since all scripts in Perspective run on the Gateway.

---

<div class="post-metadata">

**Author:** ![Steve\_Dilley](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Steve\_Dilley](https://forum.inductiveautomation.com/u/Steve_Dilley)\
**Post date:** [November 23, 2022, 11:59am UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/6 "2022-11-23T11:59:45Z")

</div>

Hello, I am new to this but has anyone resolved this issue. I have ignition edge and am using perspective. I need to run an external .bat file which is on the windows/desktop but i can't seem to get it to work. If i use the script console it works but not if i use with a button ?

Any Help really welcome

---

<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:** [November 23, 2022, 12:12pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/7 "2022-11-23T12:12:48Z")

</div>

All scripting in a Perspective session executes on the gateway. Unless you happen to be running your browser on the same server as the gateway is installed there is no possibility of executing anything on the user desktop (or anywhere else) from a browser.

---

<div class="post-metadata">

**Author:** ![Steve\_Dilley](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@Steve\_Dilley](https://forum.inductiveautomation.com/u/Steve_Dilley)\
**Post date:** [November 23, 2022, 12:18pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/8 "2022-11-23T12:18:53Z")

</div>

Thanks Kevin. I think I know what you mean

---

<div class="post-metadata">

**Author:** ![Levi\_Taylor](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@Levi\_Taylor](https://forum.inductiveautomation.com/u/Levi_Taylor)\
**Post date:** [February 2, 2023, 4:29pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/9 "2023-02-02T16:29:24Z")

</div>

I have a system where the browser and the gateway are installed on the same machine, and I am trying to open an application, such as notepad.exe. Per your verbiage, is this then possible?

I appreciate any help or advice on this.

---

<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:** [February 2, 2023, 4:47pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/10 "2023-02-02T16:47:43Z")

</div>

> [@Levi\_Taylor](#):
>
> Per your verbiage, is this then possible?

Generally, no. Windows doesn't allow background services (Ignition Gateway) to interact or spawn programs with a UI.

If you want to spawn a program with a GUI then doing it from a Vision application is probably the easiest way.

---

<div class="post-metadata">

**Author:** ![Daniel\_Ramon1](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Daniel\_Ramon1](https://forum.inductiveautomation.com/u/Daniel_Ramon1)\
**Post date:** [February 22, 2023, 6:06pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/11 "2023-02-22T18:06:05Z")

</div>

Is it possible to open an external python script from the gateway machine? I can do it in the script console in ignition designer with no issue with the system.util.execute(), but I have not been able to make it from a tag script or gateway event.

> **[Python In Ignition](https://support.inductiveautomation.com/hc/en-us/articles/360056397252-Python-In-Ignition)**
>
> An Advanced Primer — Python, Libraries, Versions, and the Future
>  
> Background
> Ignition provides users with the ability to do Python scripting as a core part of the Ignition platform. Ignition and I...

In this article shows ways to accomplish the calling from ignition to python, but I do not know how I can achieve this from the Gateway machine.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 22, 2023, 7:27pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/12 "2023-02-22T19:27:26Z")

</div>

You cannot.

If you are trying to open an external executable where the Perspective client is, you run into two problems:

1. The jython in your action is running in the gateway, not in the browser's environment, and
2. Browsers don't let websites run arbitrary local executables. That would be a huge security hole. It is possible to install a URL handler in a browser to open an application, but that can only happen as part of a local software install outside the browser.

If you are trying to open a GUI executable on the gateway itself, you will be blocked by Windows' isolation between desktops and background services. (Similar in Linux.)

If you are trying to run a non-GUI script on the gateway, system.util.execute() should work if the gateway service has permissions for all of the files and folders you are attempting to access, and you don't expect to see anything open. If you need to get results from and external program, use java's ProcessBuilder to set up monitoring of pipes and exit code.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [February 24, 2023, 8:04pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/13 "2023-02-24T20:04:51Z")

</div>

> [@pturmel](#):
>
> blocked by Windows' isolation between desktops and background

You can get around this by setting the Ignition service to run under a user that does have privileges to do the things you're trying to do, instead of under the default SYSTEM user

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 24, 2023, 9:12pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/14 "2023-02-24T21:12:16Z")

</div>

Hmmm, pretty sure the "Interact with Desktop" stuff became a lie in Windows 8 or 10. You should try it and let us know.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [February 24, 2023, 9:14pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working/47569/15 "2023-02-24T21:14:34Z")

</div>

Oh right, yes I think you're right. I was thinking about accessing fileshare paths and other security permissions. But actually executing things is still not allowed, as you mentioned. That's what I get for trying to process things in the wee hours
