I am trying to create a simple program that starts up steam from my computer. I have a shortcut on my desktop of steam and when you double click it, it runs the process "steam.exe"


When my program executes the line of code "system("start steam.exe")" I get an error saying that windows cannot find steam.exe.

How do I fix this?

Provide the full path to the executable? But really, if your program merely opens a canned program, why not go with just a link to that program to begin with?

This is just practicing the basics to make sure my memory hasn't faded :)

But when entering the full path, do I put it in the same string as "start" or is this method different?

This would be my first guess:

system("start path/to/steam.exe");

This would be my first guess:

system("start path/to/steam.exe");

That is what I first tried but it got an error

I put it

system("start C:\Program_Files\Steam\steam.exe");

but I get an error saying it can't find "C:Program_FilesSteamsteam.exe"

it reads it without the backslashes. Is that because of dev-c++?


EDIT: I changed the backslashes to forward slashes but it still says it can't find "C:/Program Files/Steam/steam.exe"

Try

system("start \"C:/Program Files/Steam/steam.exe\"");

hmm that took me to a separate dos window that just repeated the path file of my .cpp back to me

Yup. Let's 86 the 'start'.

system("\"C:/Program Files/Steam/steam.exe\"");

awesome thank you for the help!

Oh yeah, now is there a way to check if steam is already running before it tries to execute it?

Maybe something like this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.