70

I recently find myself needing to start Steam in offline mode rather frequently (my wife is hogging my account to play Plants Vs. Zombies, and most of what I play doesn't really need to be online).

I was wondering if there is some way to launch Steam in offline mode without first logging in (and selecting it from the menu), since that usually beats the purpose.

While I know that killing my network connection before launching Steam is an option, I am looking for a more "civilized" way, such as a command line switch or something of the sort.

Aubergine
  • 19,336
  • 22
  • 101
  • 173

2 Answers2

35

I can confirm that creating/editing steam.cfg (in the same directory as the Steam executable) with the following lines works, as long as you've set Steam to remember your password (thanks DarkAnime):

BootStrapperInhibitAll=enable
ForceOfflineMode=enable

If you want to manage this with a command-line parameter, you could create a script to do something like the following (Windows .bat file):

IF "%1"=="offline" (
    IF EXIST steam.cfgx (
        rename steam.cfgx steam.cfg
    )
)
ELSE (
    IF EXIST steam.cfg (
        rename steam.cfg steam.cfgx
    )
)
start steam.exe

It used to be that you could hit "Cancel" while Steam was starting up and it would allow you to start offline mode from there, but that no longer works.

Matthew Read
  • 19,267
  • 11
  • 89
  • 149
33

New, working solution (2016-04-01 and it still works):

Make sure you've set Steam to remember your password. Now open <Steam_installation_dir>/config/loginusers.vdf and change value of WantsOfflineMode to 1. Default location of this file:

  • Windows (32-bit): C:\Program Files\Steam\config\loginusers.vdf
  • Windows (64-bit): C:\Program Files (x86)\Steam\config\loginusers.vdf
  • Linux: ~/.steam/steam/config/loginusers.vdf
  • Mac: ~/Library/Application Support/Steam/config/loginusers.vdf

If you don't want warning about launching Steam in offline mode just do the same with SkipOfflineModeWarning. If you can't see those values, just add them so it looks like this:

"users"
{
    "<your profile number>"
    {
        "AccountName"       "<your login>"
        "PersonaName"       "<your display name>"
        "RememberPassword"      "1"
        "Timestamp"     "<timestamp>"
        "WantsOfflineMode"      "1"
        "SkipOfflineModeWarning"        "1"
    }
}

There can be of course more users listed.

You can change those values back to 0 to launch Steam in online mode.

NOTE: Steam will automatically reset SkipOfflineModeWarning to 0 when it closes. To prevent this you can set the file to read-only, but then you can't switch back easily to online mode nor make Steam remember another user. Alternatively you can use some script to change those values for you.

To automate this on Windows machines, save

Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("config\loginusers.vdf", ForReading)

Do Until objFile.AtEndOfStream
    strLine = objFile.ReadLine
    If InStr(strLine, "WantsOfflineMode") = 0 And InStr(strLine, "SkipOfflineModeWarning") = 0 Then
        strText = strText & strLine & vbCrLf
    End If
Loop
objFile.Close

If WScript.Arguments.Count = 1 Then
    strText = Replace(strText, "RememberPassword", "WantsOfflineMode"" ""1"" ""SkipOfflineModeWarning"" ""1"" ""RememberPassword")
    mode = WScript.Arguments(0)
Else
    strText = Replace(strText, "RememberPassword", "WantsOfflineMode"" ""0"" ""SkipOfflineModeWarning"" ""0"" ""RememberPassword")
    mode = "online"
End If

Set objFile = objFSO.OpenTextFile("config\loginusers.vdf", ForWriting)
objFile.WriteLine strText 

objFile.Close

Set objShell = CreateObject("WScript.Shell")

If (mode = "offline") Or (mode = "online") Then
    objShell.Exec("Steam.exe")
Else
    objShell.Run("steam://rungameid/" & mode)
End If

as steam.vbs in your Steam directory and make two shortcuts to it. Add offline as parameter to one of them and it's done. I have two Steam shortcuts on my desktop now. Steam Online with path "C:\Program Files (x86)\Steam\steam.vbs" and Steam Offline with path "C:\Program Files (x86)\Steam\steam.vbs" offline.

I added support for games, so you can launch them in offline mode. Just start steam.vbs with app id as parameter. Example: "C:\Program Files (x86)\Steam\steam.vbs" 440 launches Team Fortress 2 in offline mode.

Tithen-Firion
  • 873
  • 9
  • 17
  • As of the present time, this solution appears not to work anymore. – Kyralessa Feb 01 '15 at 00:48
  • Solution works fine. Code I gave to automate it does not. I'll update it later. – Tithen-Firion Feb 06 '15 at 10:53
  • Still works. Now you can launch games in offline mode too with this script. – Tithen-Firion Sep 02 '15 at 23:32
  • It's worth noting that the SkipOfflineModeWarning setting is reset each time Steam runs. For a permanent solution, if you don't want to use the script each time you launch, you can set loginusers.vdf to be read-only. – Alexander Pruss Feb 01 '16 at 16:06
  • 1
    If you set loginusers.vdf to read-only you can't switch back to online mode easily. You have to uncheck read-only flag first, which is much more to do than simply running shortcut from desktop. I see no problem using script every time you run Steam. Also when that file is read-only you can't make Steam remember new users. – Tithen-Firion Feb 08 '16 at 09:39
  • Hi, how can I obtain the profile number? The file doesn't exist in my Mac, and I have to make it. – xrisk Apr 01 '16 at 07:37
  • @Rishav Did you check in ~/Library/Application Support/Steam/config/loginusers.vdf? It should be there according to this comment. Note that you have to login once and make Steam remember your password to make it work. Creating this file manually won't do the trick. – Tithen-Firion Apr 01 '16 at 10:41
  • @PiotrKowalski thank you! I was searching in the wrong location for that file... (inside /Applications/Steam.app). – xrisk Apr 01 '16 at 13:56
  • This works for me on PlayOnLinux. – Elliott Nov 19 '17 at 14:59
  • @PiotrKowalski: In my case its working properly, but once steam launches, it sets 'WantsOfflineMode' to 0. Is it expected? – Anurag Daware Apr 11 '18 at 06:12
  • @AnuragDaware that's strange, WantsOfflineMode should stay at 1. Read the NOTE part for expected behaviour. If you use the script it doesn't matter anyway. – Tithen-Firion Apr 11 '18 at 07:14
  • Here's an alternative Python implementation that is less sensitive to the order of keys in that file: https://gist.github.com/qguv/fa7fb937173e2e05181e4bbbe194f843 – Quint Dec 04 '18 at 02:19
  • @Quint consider using vdf module ;) – Tithen-Firion Dec 04 '18 at 08:59
  • For my Ubuntu install the file was in /home/amama/.local/share/Steam/config/config.vdf. I had forgotten I had set it to be owned by root with 644 permissions months ago and my steam got stuck on offline only. Duplicating the .desktop launcher file and appending -offline to the command line seems like a better approach. – Ray Foss Sep 19 '21 at 05:08
  • Created a simple shell wrapper script for Linux: https://gist.github.com/ttrei/e4d42c393268622c0bf873e30fcc80f4

    I use it to seamlessly start offline Steam games without interacting with Steam interface at all: steam-offline.sh -applaunch 1118310

    – R. Taukulis Feb 18 '22 at 10:31
  • This doesn't work if you've never logged into your account. I just tried creating a file based on information of another account, filing it with information of my actual account, and it still launched Steam in online mode. – Clockwork Jul 04 '23 at 16:26