Need to run exe file in user:// filesystem area

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Blockyheadman

I’m trying to run an exe file on my launcher type program & I can’t seem to make it happen. I’ve done tests to see if the file is noticed in the system and it checks out. I just can’t seem to get OS.execute() to work.

I changed my user:// directory by the way to this:

I also added an extra folder inside the user:// folder called apps using some code so keep that in mind.

Here’s what my checking piece looks like,

if (app.file_exists("user://apps/app.exe")):
		OS.alert("App Found!", "Found!")

And my execute code,

func _on_Button_pressed():
	OS.execute("user://apps/app.exe", [])
:bust_in_silhouette: Reply From: rossunger

My first thought is "does OS.execute understand what “user://” is? like, file_exists might be able to interpret that, but OS.execute might not?

Sanity checks:

  • does the app run when you execute it manually from explorer?
  • does _on_Button_pressed() actually get called?
  • have you tried using the full file path instead of “user://” ?
  • have you tried OS.execute(“cmd.exe”, [“PATH TO YOR APP”]?

Possible but unlikely issues:

  • permissions? are you running as admin?
  • firewall / defender?
:bust_in_silhouette: Reply From: Blockyheadman

It turns out that when I try to use user:// directly, it doesn’t take it but if I put the path into a variable like this:
var app_file = OS.get_user_data_dir()+"/"+"apps"+"/"+"app.exe"
And use the variable as the file path for execution, then it functions properly.