Posted: Sat Jan 16, 2021 10:41 am Post subject: To close the game, is there any other lua code?
I did some research and tried what I found.
DB suggested as follows; See the correct name of the game with "Windows Logo + R".
I tried it and verified the game name.
I saw it listed with the same name in the CE transaction list.
It is listed with the same name in the task list.
But the code below does not close the game.
Any other suggestions?
Process List;
00001594-Game One.exe
Task Manager List;
Game One (PID:5524)
Windows + R path;
"C:\Program Files\GameOne\Game One.exe"
Kill code;
os.execute("taskkill /F /IM Game One.exe")
Open code;
os.execute([["C:\Program Files\GameOne\Game One.exe"]])
os.execute("taskkill /F /IM cmd.exe")
And the program doesn't close with this code.
os.execute("taskkill /F /IM Game One.exe")
(It shuts down manually from the task manager.)
The same code is closing other apps.
What other way can I try?
You're not escaping the space in the name. It's like you're passing the word "Game" to the "/im" option, and a separate parameter "One.exe" that taskkill doesn't do anything with.
Code:
os.execute'taskkill /im "Game One.exe"'
If you can easily get the pid, that would be better.
Code:
os.execute'taskkill /pid 5524'
_________________
I don't know where I'm going, but I'll figure it out when I get there.
You're not escaping the space in the name. It's like you're passing the word "Game" to the "/im" option, and a separate parameter "One.exe" that taskkill doesn't do anything with.
Code:
os.execute'taskkill /im "Game One.exe"'
If you can easily get the pid, that would be better.
Thanks .. We found this solution at the same time.
If I couldn't find it anyway, your answer is life-savingly gratifying.
+1 includes this answer, thank you.
here is the code for those who follow;
Code:
local procesID = getProcessIDFromProcessName("Game One.exe")
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum