How to trigger opening html file by default browser in GMS

45 Views Asked by At

I'd like to use LaunchExternalProcess to trigger opening html file in GMS. I have tested the command in cmd, and it works. The cmd command is

start X:\Manual\index.html

But if I use the code below in GMS, it will say it can't file the file

String cmd = "start X:\\Manual\\index.html"
LaunchExternalProcess(cmd)
1

There are 1 best solutions below

0
On BEST ANSWER

Try

string msg = "cmd.exe /c" 
msg += "start C:/temp/test.htm"
LaunchExternalProcess(msg)

Note that the LaunchExternalProcess() command is not the same as being within the command prompt. It is rather like running a link-icon, i.e. one specifies the executable to run.

The "start" command is a command within the command prompt, not an executable. So one has to "launch" the command prompt (/c to not show the window) and pass the command prompt's command as a parameter of that call.