Steam launch commands: a way to launch a little script?

I know you can personalize the launch of a game by adding specific commands on Steam. Can you add a command that runs a little .bat script?


No, but you can achieve the same result with a bit of a hack.

Launch arguments aren't related to batch files. You can use a batch file to launch something with launch arguments but not the other way around. However, if you want to launch the game through Steam and make the batch file run before the game, you can use the steps below to achieve that.

  1. Go to the game's installation folder and find the .exe file for the game. Rename it from something like game.exe to game_real.exe, for example.
  2. At the end of your batch file, add a command that runs your executable, obviously replacing game_real.exe with your renamed game's executable:

    start "" game_real.exe

  3. Find a tool that compiles a .bat batch file into a .exe executable. I haven't tested it but you could try this one at your own risk. Use this to compile your batch file. You may want to play around with the settings to make it not visible and whatever else you want.

  4. Rename the resulting executable to the original name of the game's executable, game.exe in this example. Put this in the same folder as your game's executable.

That should be it. The batch file will run in place of the game when launched from Steam, then it will launch the actual game when it completes your desired actions. If the game has an update that changes the game's executable, your script will be replaced with that. Verifying the integrity of the game cache files will also replace your script with the real executable again. If that happens, just repeat these steps, discarding the old renamed game executable.


For those Google pilgrims arriving in the future:

'Add a game...' → 'Add a Non-Steam Game' → 'Browse...' → 'C:\Windows\System32\cmd.exe'.

On new shortcut "cmd.exe" → 'Properties':

  • Name: Awesome Game

  • Target: "C:\Windows\System32\cmd.exe" /k C:\Location\Of\File.bat

  • Start In: the path your game lives in, like "C:\Steam\steamapps\common\AwesomeGame"

Obviously, the .bat file should contain something like "start C:\Steam\steamapps\common\AwesomeGame\a_game.exe"


Short answer: No

The Steam launch commands are no different from adding launch commands to the application's shortcut. It depends on each application what they will or won't parse. You can't run any scripts or anything, unless the game itself has such functionality, in which case, it's not relevant to steam launch commands.

There are different ways of executing commands on software launch, one of them being AutoHotkey scripts, which allows automatic command execution when a process is detected.
Another way would be creating a batch file that will execute the command and then run the game executable, although that may not work with all games (mmorpg's with cheat protection specifically). @Keavon's answer explains how to create an executable out of a batch file, so you can run it directly through steam, rather than through a shortcut.


YES

  1. Create a shortcut of the steam game;
  2. Right-click the shortcut then go to 'Properties';
  3. Copy the URL;
  4. Go into the batch file and use start (the url without brackets)

For example my .bat file is:

@echo off
start steam://rungameid/730
cd D:\Desktop\csgo_dont_blind_me
start app.exe
exit