# Issue running bat file using system.util.execute

**URL:** <https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148>\
**Category:** Ignition\
**Created:** [May 2, 2023, 3:02pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148 "2023-05-02T15:02:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [May 2, 2023, 3:02pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148/1 "2023-05-02T15:02:03Z")

</div>

Kinda lost on this. Ignition 7.9, I am trying to execute a bat file that runs commands to transfer files via ftps thru filezilla pro cli. The batch file works if I run it standalone or thru a cmd line. It also works if I run it in the script console, but it will not run thru a gateway script.

Its kind of confusing because I am able to run a similar program called putty sftp from a gateway script and I have another bat file that moves the csv file that I create into a "history" directory using a gateway script.

Any ideas I am at a loss?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 2, 2023, 3:10pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148/2 "2023-05-02T15:10:57Z")

</div>

My best guess is some sort of user permissions issue. The gateway would have different permissions than a client running under a different user. I suggest searching the forum in regard to changing the Ignition service user.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [May 2, 2023, 3:15pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148/3 "2023-05-02T15:15:22Z")

</div>

Is filezilla on the gateway? Running it through a gateway script means it's running it with the file system on the gateway computer. Are you able to run it through command line on the gateway computer?

If so then @dkhayes117 is most likely correct and it's most likely a permission issue.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [May 2, 2023, 3:17pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148/4 "2023-05-02T15:17:06Z")

</div>

yes everything is local to the computer. Like I said the weird thing is I can run a bat file that moves files in the same folder that the filezilla bat file resides in... thru a gateway script.

---

<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:** [May 2, 2023, 3:18pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148/5 "2023-05-02T15:18:03Z")

</div>

Consider also using java's `ProcessBuilder` instead of `system.util.execute`. You can collect the `stdout` and `stderr` streams to log, and capture the process exit code.

---

<div class="post-metadata">

**Author:** ![Kfoldesi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kfoldesi/32/11327_2.png) [@Kfoldesi](https://forum.inductiveautomation.com/u/Kfoldesi)\
**Post date:** [May 2, 2023, 3:20pm UTC](https://forum.inductiveautomation.com/t/issue-running-bat-file-using-system-util-execute/73148/6 "2023-05-02T15:20:58Z")

</div>

I have gotten around this kind of issue before. Try to run a shortcut to the .bat. Set the shortcut to run as admin.
