Friday, May 6, 2016

Steam Failed to Start Game (App Already Running)



A few Steam client versions prior to the 4/29/2016 build, I began receiving the following error when attempting to start Garry's Mod (aka GMod):

 



Steam reports it is still running even though I had cleanly exited via GMod's interface:




Following the Steam support site link got me nowhere, and googling revealed this bug has occurred in the past more than once (perhaps Valve needs to do better at regression testing?), with no solutions that jumped out. I did discover though that ending the Steam.exe process tree in Task Manager, and then deleting some cached files in Steam's appcache folder, seems to at least work around the problem. 



 

 
Manually this is a bit of a pain, but there is a way to automate this particular workaround which involves creating a batch file to run GMod instead of using the default shortcut Steam creates for it. Here's how. 
  1. Right-click on the desktop shortcut for Garry's Mod, then click Properties.
  2. Click twice to select the text in the URL box, then hit Ctrl-C to copy it to the clipboard.

  3. Open a text editor (I like Notepad++) and hit Ctrl-V to paste the URL into it, and then type the word START and a blank space so that it looks like this:
    START steam://rungameid/4000

  4. Above the URL you just pasted, copy and paste the following text:
    TASKKILL /IM "Steam.exe" /T /F

    The batch file should now look something like this:



  5. Save the file with whatever file name (I used gmod) and the extension .BAT (for batch file) on your Desktop or wherever makes sense. Then, you can either click twice to run it directly, or create a shortcut and use that instead.

       
 
When the batch file is run, this will tell Windows to first execute TASKKILL (a built-in Windows utility) and tell it to close Steam.exe (/IM "Steam.exe") along with any child processes in its process "tree" (/T) forcibly (/F). After that, it will then start a new process to open Steam and then GMod. It'll be as if you'd gone through the steps described above manually, only without the manual part.

The above can be adapted for most any other Steam game having this problem; you'd simply open that other game's shortcut in step 2 and go from there to create a new batch file for it.