• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Execute_shell : syntax ?

I want to use execute_shell inside a GMS2 program to open the file mesresultats.txt which is in the following directory C:\Users\Erik\AppData\Local\Test_réseaux_sociaux with Libre Office Writter which is in the directory C:\Program Files\LibreOffice\program\soffice.exe".

What I know is only : execute_shell(command,wait) but how to write command and what is wait ?

I try this but it doesn't work !
execute_shell("C:\Program Files\LibreOffice\program\soffice.exe C:\Users\Erik\AppData\Local\Test_réseaux_sociaux\mesresultats.txt",1);

Is there anyone to help me ?

Samuel Venable

Time Killer
ok, so the common misconception here is that the command line can auto detect spaces in file paths. It cannot. You need quotes around each file paths and other kinds of command line arguments that could potentially contain spaces, just like you would need this in command prompt.

otherwise each string divided by spaces will be interpreted as separate command line arguments.

so if that really is the way you open a file in soffice.exe, it may be corrected by doing:
execute_shell("\"C:\\Program Files\\LibreOffice\\program\\soffice.exe\" \"C:\\Users\\Erik\\AppData\\Local\\Test_réseaux_sociaux\\mesresultats.txt\"",1);
wait is whether the game should not process any events and remain paused while the program you executed remains opened.

The above code is for GMS2. For GMS1.4:
execute_shell('"C:\Program Files\LibreOffice\program\soffice.exe" "C:\Users\Erik\AppData\Local\Test_réseaux_sociaux\mesresultats.txt"',1);
Last edited:
Thank you for your response.

No error occurs when I run my GMS2 program but nothing appends.
I have tried with soffice.exe and after with wordpad.exe without success. Nothing appends.

// execute_shell("\"C:\Program Files\LibreOffice\program\soffice.exe\" \"C:\Users\Erik\AppData\Local\Test_réseaux_sociaux\mesresultats.txt\"",1);
// execute_shell("\"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\wordpad.exe\" \"C:\Users\Erik\AppData\Local\Test_réseaux_sociaux\mesresultats.txt\"",1);
execute_shell("\"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\wordpad.exe\"",1);
game_end() // fin de partie !!!!!!!!!!!!!!!!!

2 pictures in attach files.

What do you think about that ?


Samuel Venable

Time Killer
Edit: lol! I forgot escaping when I corrected you! my bad! XD I updated my post above with the correct code.

First, it's very unlikely anyone would want to install libre office in order to run your game or app.

Second, that is not the correct path to wordpad. It looks like you fused together the path to the exe with the path to the start menu shortcut.

Try this:

C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe

Also you are not using escaping on the backslashes like i do above, that's why libre office isn't opening either.

If you read the GMS2 manual it explains everything that has changed with referencing file paths and string character escaping:

These things are completely irrelevant to my extension. They are changes to GameMaker that no one pays attention to and I find half a dozen support tickets about the same thing consequently. But it's not your fault. I think yoyogames should've posted a blatant news article and emails to their subscribers warning about these changes so it would be more well known before the transition to GMS2, not after. I admit it is confusing to new users who aren't familiar with character escaping and it is hard to just expect users of the software to just automatically know when to check the docks for huge changes like this, it's unrealistic.

Hope this helps! And thank you for using the forums, but instead I wish more people would just message me on here, because people will look at the title and go "this is an extension support ticket and has nothing to do with GameMaker itself" and will likely ignore it.
Last edited:

Ok, my GMS2 runs good.
At the end of my GMS2 program, LibreOffice (or Wordpad) runs and opens the files mesresultats.txt. So, the students can see their results and print them.

with LibreOffice
execute_shell("\"C:\\Program Files\\LibreOffice\\program\\soffice.exe\" \"C:\\Users\\Erik\\AppData\\Local\\Test_réseaux_sociaux\\mesresultats.txt\"",1);

or with Wordpad
execute_shell("\"C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe\" \"C:\\Users\\Erik\\AppData\\Local\\Test_réseaux_sociaux\\mesresultats.txt\"",1);

Now, I can finish my GMS2 program to my students for september.

Thank you very much for your help