All Discussions > Steam Forums > Off Topic > Topic Details
void* Jul 7, 2015 @ 6:34pm
[SOLVED] Anyone knows how to start a steam game with C# ?
Hey guys,
like the title says I am looking for a way to start a steam game with my c# application. I just can't find out how. If I just start the process the game alerts that it wasn't started with steam. So I need to start the game with steam. I hope someone can help me here. Google was no help =/

[SOLVED]
You can find my solution in my open source code here: https://github.com/tr0teK/GTA-V-Mod-Manager

in ModGUI.cs (Line: 253)

Code Example to start a steam game with arguments:

private Process gtav = new Process();
...
gtav.StartInfo.FileName = @steamPath;
gtav.StartInfo.Arguments = "-applaunch 271590 -StraightIntoFreemode";
gtav.Start();
Last edited by void*; Nov 30, 2015 @ 3:57pm
< >
Showing 1-11 of 11 comments
Murda Jul 8, 2015 @ 3:20pm 
Why would you want to start it outside Steam?

Edit: to help you out with your question: Check this out. Those are commands that can be pasted in your browser or Window's Run promp.

The one you wanna use is steam://run/<id>

steam://rungameid/<id> for non-steam games and modded games

Try to make your program to execute that command within your browser or Windows
Last edited by Murda; Jul 8, 2015 @ 3:29pm
Murda Jul 8, 2015 @ 3:26pm 
Originally posted by WarningSign:
Why would you want to start it outside Steam?

Edit: to help you out with your question: Check this out. Those are commands that can be pasted in your browser or Window's Run.

The one you wanna use is steam://run/<id>
Try to make your program to execute that command within your browser or Windows

replace <id> with the appid of the game
Originally posted by troteK:
Hey guys,
like the title says I am looking for a way to start a steam game with my c# application. I just can't find out how. If I just start the process the game alerts that it wasn't started with steam. So I need to start the game with steam. I hope someone can help me here. Google was no help =/
Are you saying you want to start a game in steam or or start one of your own applcations with steam?
Sora Jul 8, 2015 @ 4:32pm 
You could try something like this, i havent actually tested it though.. Dont have my dev tools with me :(

---

using System.Diagnostics;

bool ProcShell = false;
bool ProcWindow = false;
Process Proc = new Process();

startApp();

private void startApp()
{
Proc.StartInfo.FileName = "steam.exe";
Proc.StartInfo.Arguments = "-applaunch APPID CMDLINE";
Proc.StartInfo.UseShellExecute = ProcShell;
Proc.StartInfo.CreateNoWindow = ProcWindow;
Proc.Start();
}
Last edited by Sora; Jul 8, 2015 @ 4:33pm
void* Jul 8, 2015 @ 5:47pm 
thats for your answers I already find out earlier. I used the Steam API Web Protocol to solve my problem. I am currently working on a mod manager for a steam game and needed a way to start the game with my application through steam. But everything works fine now.
void* Jul 8, 2015 @ 6:23pm 
*barrel roll* - nice...
Last edited by void*; Jul 8, 2015 @ 6:23pm
sρo_okeя⁹⁵ Aug 2, 2015 @ 8:33am 
Last edited by sρo_okeя⁹⁵; Mar 12, 2016 @ 4:55am
James Nov 30, 2015 @ 3:30pm 
I would recommend you using the appid. So you can start the game with a link. As an example "steam://appid=401" (unsure)

Create a desktop icon and hover your mouse over it to see the link.
void* Nov 30, 2015 @ 3:46pm 
Originally posted by Spacebeanie #+GF+:
I would recommend you using the appid. So you can start the game with a link. As an example "steam://appid=401" (unsure)

Create a desktop icon and hover your mouse over it to see the link.

This is quite an old thread and I already found a better solution for this. thank you anyways :)
James Dec 3, 2015 @ 8:00am 
No problem xD at least i somehow helped xD
󠀡󠀡 Jul 23, 2024 @ 4:12pm 
old asf but for anyone else, here's a function I cobbled together

static void LaunchViaSteam(string gameId)
{
try
{
string steamUrl = $"steam://rungameid/{gameId}";
Process.Start(new ProcessStartInfo
{
FileName = steamUrl,
UseShellExecute = true
});
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
}
< >
Showing 1-11 of 11 comments
Per page: 1530 50

All Discussions > Steam Forums > Off Topic > Topic Details
Date Posted: Jul 7, 2015 @ 6:34pm
Posts: 11