Find steam games folder

Thomsen1707 picture Thomsen1707 · Dec 4, 2015 · Viewed 8.2k times · Source

How can I get to a Steam game folder without hardcoding it?

Instead of hardcoding C:\Steam\steamapps\common\<game_folder>\GameData in my code can I use something involving the steamappid of a game to obtain this information automatically?

Answer

tezzo picture tezzo · Dec 4, 2015

In order to obtain a Steam games folder you have to follow this steps:

  1. find Steam installation folder
  2. check Steam acf files and libraryfolders.vdf

You can find Steam InstallPath in windows registry:

  • 32-bit: HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam
  • 64-bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam

You can read a Value from a Registry Key using this code:

Dim strSteamInstallPath as String = My.Computer.Registry.GetValue(
    "HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam", "InstallPath", Nothing)

MsgBox("The install path is " & strSteamInstallPath)

Once you have Steam main folder (the one containing steam.exe) you can read games installation folder from appmanifest_<steamappid>.acf files contained in \steamapps subfolder.

For example, appmanifest_2280.acf contains informations about Ultimate Doom.

You can search for a particular steamappid or analyze every files and get game name from name key.

Also check libraryfolders.vdf in \steamapps subfolder for other game installation folders.

For example I have some games in D:\mygames so my libraryfolders.vdf is:

"LibraryFolders"
{
    "TimeNextStatsReport"   "xxxxxxxxxxx"
    "ContentStatsID"        "xxxxxxxxxxx"
    "1"                     "D:\\mygames"
}

Once you have this alternative folder, check for acm files contained in \steamapps subfolder.