How do I create an shortcut to a Steam game with a server specified?

Solution 1:

You can always join a Steam enabled game via this command:

steam://connect/IP_ADDRESS:PORT

So to join a Server on 127.0.0.1:27016 you would type:

steam://connect/127.0.0.1:27016

Now, to get this into a shortcut, rightclick on your desktop and create a new Shortcut. In the upcoming dialog, enter the above command into the box after you replaced IP_ADDRESS with the address of the server, and PORT with the port number of the server):

Screenshot of Dialog

In the next Box, enter the name of the game or whatever you want:

Screenshot of Dialog

That creates a shortcut that will directly launch the game that the server belongs to and will connect you to it. Steam needs to be running for this.

While the screenshots where taken on Windows 7, it should be the same on Windows 8. This also works for all Steam Games that use Steamworks for Multiplayer.

Free Bonus DLC:

To change the icon of the created shortcut, rightclick it, select "Properties" in the upcoming menu, then select the "Change Icon" button. Then navigate to the .exe or .ico of your game and select it. In the next window that pop ups you can select a different icon for your shortcut taken from this .exe.

Screenshot of how to select an icon

Literal answer

To create a literal .exe out of this, put this code into a .cpp file:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdLine, int nCmdShow)
{
    ShellExecute(NULL, L"open", L"steam://connect/127.0.0.1:27016", NULL, NULL, SW_SHOW);
}

Then compile it with the free version of Visual Studio with this command:

cl /DYNAMICBASE "shell32.lib" /D"WIN32" /D"_UNICODE" /D"UNICODE"  SpaceEngineers.cpp  

Then you can use this .exe to launch Space Engineers. Remember to replace the 127.0.0.1 with the address you want to connect to, and 27016 with the port that the server runs on.