how can I force exported windows exe only one running instance at same time?

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

how can I force exported windows exe only one running instance at same time?

:bust_in_silhouette: Reply From: GameSchool

Hi

I don’t know if I understood you correctly, but will this help?

var output = []
OS.execute("tasklist", [], output )
for line in output[0].split("\n"):
	if line.begins_with("chrome"):
		get_tree().quit()

In this example I’m using the cmd command tasklist to get info about all the running processes, and using a for loop to check them one by one. If a line start with the word “chrome” (Every line except the first one will start with the name of a process), I exit the program.
You will have to count the amount of processes to make sure there are more than one.

thanks & I will try

jia | 2023-04-07 01:38