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.
- Go to the game's installation folder and find the
.exefile for the game. Rename it from something like
game_real.exe, for example.
At the end of your batch file, add a command that runs your executable, obviously replacing
game_real.exewith your renamed game's executable:
start "" game_real.exe
Find a tool that compiles a
.batbatch file into a
.exeexecutable. 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.
- Rename the resulting executable to the original name of the game's executable,
game.exein 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':
"C:\Windows\System32\cmd.exe" /k C:\Location\Of\File.bat
Start In: the path your game lives in, like
Obviously, the .bat file should contain something like
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.
This is a bit late, but you can issue any OS shell commands by using the keyword
%command%. If that keyword is present in the options, it will run whatever you put in the options field on the command-line (
cmd.exe on Windows,
/bin/sh on mac OS and Linux) and substitute the keyword with the game's executable. You can separate different commands with semicolons, just like on the command-line.