vb.net 找到 Steam 游戏文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34090258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Find steam games folder
提问by Thomsen1707
How can I get to a Steam game folder without hardcoding it?
如何在不进行硬编码的情况下访问 Steam 游戏文件夹?
Instead of hardcoding C:\Steam\steamapps\common\<game_folder>\GameDatain my code can I use something involving the steamappidof a game to obtain this information automatically?
C:\Steam\steamapps\common\<game_folder>\GameData我可以使用涉及steamappid游戏的东西来自动获取此信息,而不是在我的代码中进行硬编码吗?
回答by tezzo
In order to obtain a Steam games folder you have to follow this steps:
要获得 Steam 游戏文件夹,您必须按照以下步骤操作:
- find Steam installation folder
- check Steam
acffiles andlibraryfolders.vdf
- 找到 Steam 安装文件夹
- 检查 Steam
acf文件和libraryfolders.vdf
You can find Steam InstallPathin windows registry:
您可以InstallPath在 Windows 注册表中找到 Steam :
- 32-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam - 64-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam
- 32 位:
HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam - 64 位:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam
You can read a Value from a Registry Keyusing 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>.acffiles contained in \steamappssubfolder.
拥有 Steam 主文件夹(包含steam.exe)后,您可以从子文件夹中appmanifest_<steamappid>.acf包含的\steamapps文件中读取游戏安装文件夹。
For example, appmanifest_2280.acfcontains informations about Ultimate Doom.
例如,appmanifest_2280.acf包含有关 的信息Ultimate Doom。
You can search for a particular steamappidor analyze every files and get game name from namekey.
您可以搜索特定steamappid文件或分析每个文件并从name密钥中获取游戏名称。
Also check libraryfolders.vdfin \steamappssubfolder for other game installation folders.
还要检查libraryfolders.vdf在\steamapps子文件夹中的其它游戏的安装文件夹。
For example I have some games in D:\mygamesso my libraryfolders.vdfis:
例如,我有一些游戏,D:\mygames所以我libraryfolders.vdf是:
"LibraryFolders"
{
"TimeNextStatsReport" "xxxxxxxxxxx"
"ContentStatsID" "xxxxxxxxxxx"
"1" "D:\mygames"
}
Once you have this alternative folder, check for acmfiles contained in \steamappssubfolder.
拥有此备用文件夹后,请检查子文件夹中acm包含的\steamapps文件。

