How would you execute a long command for CMD.exe?

Godot Version

Godot Engine v4.2.stable

Question

How would you execute a long command with Window’s CMD.exe, mainly for a specific file directory? I’m trying to use buttons that would call globe.exe(CMD) to execute a code that would create a .jpg file of a continent or country in the directory, but Godot’s DEBUG client immediately freezes up when I click them, crashes and creates no image at the location.

globe.exe is located at (B:\Globe\Main), and here is an example of the code:

func _on_pressed():
extends Button

var output = []
OS.execute("CMD.exe", ["/B", "cd Globe ", "cd Main", "globe.exe ", "Europe"], output)

And…

extends Button

var output = []
OS.execute("CMD.exe", ["/B", "cd Globe ", "cd Main", "globe.exe ", "Canada"], output)

I assume each parameter is a separate command for cmd to run. Have you tried passing Canada as a parameter to globe.exe?

OS.execute("CMD.exe", ["/B", "cd Globe ", "cd Main", "globe.exe Canada"], output)

1 Like

I tried it now, it doesn’t work unfortunately. However, I noticed moving the directory from B:\ to C:\ seems to have stopped the crashes.