Can anyone tell if it's possible to programmatically read the SteamID of the currently logged on user on Windows? Either from the filesystem or through cmd / powershell?

Context: I'm looking to make a mod for a Steam game and it's going to exchange some data with a 3rd party server. But I'll need a way to reliably tell the users SteamID for authentication and resource assignment purposes. With the scripting engine of the game I can read files from the filesystem, make http requests or run other binaries like cmd, but that's about it. The Steam SDK/API functions are not exposed.

Currently I'm reading the "LastOwner" property of the appmanifest vcf file that is created with every game in the steamapps folder. However, that one is just the ID of the user that installed the game, which is not necessarily the ID of the active user.

  • \$\begingroup\$ Getting steam user's data without using the Steam SDK sounds just wrong in so many ways. If steam doesn't support it, its probably not a good idea to get these type of data by "force". Have you searched the Steam SDK's API for a solution? \$\endgroup\$ Jan 16, 2019 at 16:37
  • \$\begingroup\$ This sounds more like a question for the creator of the game/mod api \$\endgroup\$
    – Gray
    Jan 16, 2019 at 17:19

3 Answers 3


Feeling a little dumb answering my own question, but while I tried to implement Tims answer I came across an easier solution. I found that Steam stores some data about the current Steam process in the Windows Registry. And yes, it contains the SteamID of the logged on user.

Path: HKEY_CURRENT_USER\Software\Valve\Steam\ActiveProcess

This key has an "ActiveUser" dword, which is the SteamID3 of the currently logged in user (in hex).

Knowing that, we can use the windows cmd shell to query or export the key and store it in a temporary file to read it out and extract the SteamID pretty easily.

reg export HKCU\Software\Valve\Steam\ActiveProcess steamsession.reg

This works only if you have access to the windows shell or can run batch files. If you fully rely on the filesystem only, Tims answer is probably the only way to go.

  • \$\begingroup\$ Perfect! Much better than my hack :) \$\endgroup\$
    – Tim Holt
    Jan 18, 2019 at 3:56

There is SteamID data in the Steam Program Files folder.

There may be a better way to do this, but what I've found is that the folder Steam\userdata has a series of sub-folders, and each folder is named with the steamID3 number of a user. So for each user who has logged into that Steam installation, there is a folder named with their steamID3 number.

For example, my steamID3 is [U:1:17], and I have a folder named Steam\userdata\17.

If you then look in that steamID3 named folder you will see another folder named config (path being Steam\userdata\\config). It is modified when Steam is started, and Date modified updated to the time when Steam was launched.

So I think you could do this...

  1. Check Steam\userdata folder contents
  2. If there is just one folder there, you have the steamID3 of the player (it's the directory name)
  3. If there is more than one user folder present, look at all the config files in each steamID3 named folder, and find the one with the newest config folder

Run this scan at the start of your game. You now have the ID of the last person to start up Steam. Which you can probably assume is the currently logged in user.

One thing I do not know is what happens if you start Steam, then log out one user and log in another. You should try this, and confirm that the config file for the newly logged in user gets updated.


If your app is being launched as an intermediate launcher for a game (by specifying your_app.exe %command% in the launch parameter options) then you can get the username from the SteamAppUser environmental variable.

That wasn't quite what I needed as I needed to locate the remote folder for my app so I needed to get the account_id from the username. I was able to find that in the steam config.vdf. My requirements also needed to work cross platform (win, mac, Linux).

Here's the python code I used to put it together:

    with open(_steam_config,encoding='utf8') as fp:
        for _line in fp:
            if _user in _line:
        for _line in fp:
            if m:=_pat.match(_line):
                _steam_id = m[1]
            raise ValueError("Unable to find SteamID.")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .