# System.util.execute shell script and exit codes

**URL:** <https://forum.inductiveautomation.com/t/system-util-execute-shell-script-and-exit-codes/79116>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [September 13, 2023, 8:12pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-shell-script-and-exit-codes/79116 "2023-09-13T20:12:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wdougmiller](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wdougmiller](https://forum.inductiveautomation.com/u/wdougmiller)\
**Post date:** [September 13, 2023, 8:12pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-shell-script-and-exit-codes/79116/1 "2023-09-13T20:12:23Z")

</div>

Is there a way to execute a shell script and get the exit code? ive tried system.util.execute, but it doesnt seem to be recording a response

---

<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:** [September 13, 2023, 10:25pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-shell-script-and-exit-codes/79116/2 "2023-09-13T22:25:56Z")

</div>

See this discussion earlier today:

> [@System.util.execute() does not work when executing .bat](https://forum.inductiveautomation.com/t/system-util-execute-does-not-work-when-executing-bat/79074):
>
> Hello everyone. I'm trying to execute a .bat file on my gateway, but it's not working. I've tried many different ways of writing it and different paths, I've done a lot of research on the forum, and I've also tried creating a shortcut with the "Run as administrator" option checked, but without success. Could you help me? Here are some of the commands I've tried: system.util.execute(['cmd.exe', '/C', 'C:/Program Files/Inductive Automation/Ignition/batfile/Shortcut']) system.util.execute(["cm…

---

<div class="post-metadata">

**Author:** ![wdougmiller](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@wdougmiller](https://forum.inductiveautomation.com/u/wdougmiller)\
**Post date:** [September 14, 2023, 2:01am UTC](https://forum.inductiveautomation.com/t/system-util-execute-shell-script-and-exit-codes/79116/3 "2023-09-14T02:01:08Z")

</div>

Thank you @pturmel, that was a good read. I got it working with subprocess.check\_output, but I may look at the java process builder.

Appreciate the lead.
