Skip to content

Instantly share code, notes, and snippets.

@AveYo
Last active June 10, 2025 20:12
Show Gist options
  • Save AveYo/e98a6284d6ab2ba4ad725d605d23fd3e to your computer and use it in GitHub Desktop.
Save AveYo/e98a6284d6ab2ba4ad725d605d23fd3e to your computer and use it in GitHub Desktop.
Steam minimal resource usage after removal of -no-browser & -vgui options. Enter script in powershell then use Steam_min shortcut on Desktop instead
@(set "0=%~f0" '& set 1=%*) & powershell -nop -c "$env:2=2; gc -lit $env:0|out-string|powershell -nop -c -" & exit /b ');.{
" Steam_min : always restarts in SmallMode with reduced ram and cpu usage when idle - AveYo, 2025.06.10 "
$FriendsSignIn = 0
$FriendsAnimed = 0
$ShowGameIcons = 0
$NoJoystick = 1
$NoShaders = 1
$NoGPU = 1
## AveYo: steam launch options
$QUICK = "-silent -quicklogin -forceservice -vrdisable -oldtraymenu -nofriendsui -no-dwrite " + ("","-nojoy ")[$NoJoystick -eq 1]
$QUICK+= ("","-noshaders ")[$NoShaders -eq 1] + ("","-nodirectcomp -cef-disable-gpu -cef-disable-gpu-sandbox ")[$NoGPU -eq 1]
$QUICK+= "-cef-allow-browser-underlay -cef-delaypageload -cef-force-occlusion -cef-disable-hang-timeouts -console"
$STEAM = resolve-path (gp "HKCU:\SOFTWARE\Valve\Steam" -ea 0).SteamPath
## AveYo: abort if steam not found
if (-not (test-path "$STEAM\steam.exe")) { write-host -fore red " Steam not found! "; return }
## AveYo: close steam gracefully if already running
$focus = $false
if ((gp "HKCU:\Software\Valve\Steam\ActiveProcess" -ea 0).pid -gt 0) {
start "$STEAM\Steam.exe" -args '-ifrunning -silent -shutdown +quit now' -wait; $focus = $true
}
## AveYo: force close steam if needed
while ((gps -name steamwebhelper -ea 0) -or (gps -name steam -ea 0)) {
kill -name 'asshole devs','steamwebhelper','steam' -force -ea 0; del "$STEAM\.crash" -force -ea 0; $focus = $true; sleep -m 250
}
if ($focus) { $QUICK+= " -foreground" }
## AveYo: lean and mean helper functions to process steam vdf files
function vdf_parse {
param([string[]]$vdf, [ref]$line = ([ref]0), [string]$re = '\A\s*("(?<k>[^"]+)"|(?<b>[\{\}]))\s*(?<v>"(?:\\"|[^"])*")?\Z')
$obj = new-object System.Collections.Specialized.OrderedDictionary # ps 3.0: [ordered]@{}
while ($line.Value -lt $vdf.count) {
if ($vdf[$line.Value] -match $re) {
if ($matches.k) { $key = $matches.k }
if ($matches.v) { $obj.$key = $matches.v }
elseif ($matches.b -eq '{') { $line.Value++; $obj.$key = vdf_parse -vdf $vdf -line $line }
elseif ($matches.b -eq '}') { break }
}
$line.Value++
}
return $obj
}
function vdf_print {
param($vdf, [ref]$indent = ([ref]0))
if ($vdf -isnot [System.Collections.Specialized.OrderedDictionary]) {return}
foreach ($key in $vdf.Keys) {
if ($vdf[$key] -is [System.Collections.Specialized.OrderedDictionary]) {
$tabs = "${\t}" * $indent.Value
write-output "$tabs""$key""${\n}$tabs{${\n}"
$indent.Value++; vdf_print -vdf $vdf[$key] -indent $indent; $indent.Value--
write-output "$tabs}${\n}"
} else {
$tabs = "${\t}" * $indent.Value
write-output "$tabs""$key""${\t}${\t}$($vdf[$key])${\n}"
}
}
}
function vdf_mkdir {
param($vdf, [string]$path = ''); $s = $path.split('\',2); $key = $s[0]; $recurse = $s[1]
if ($key -and $vdf.Keys -notcontains $key) { $vdf.$key = new-object System.Collections.Specialized.OrderedDictionary }
if ($recurse) { vdf_mkdir $vdf[$key] $recurse }
}
function sc-nonew($fn, $txt) {
if ((Get-Command set-content).Parameters['nonewline'] -ne $null) { set-content -lit $fn $txt -nonewline -force }
else { [IO.File]::WriteAllText($fn, $txt -join [char]10) } # ps2.0
}
@{'\t'=9; '\n'=10; '\f'=12; '\r'=13; '\"'=34; '\$'=36}.getenumerator() | foreach {set $_.Name $([char]($_.Value)) -force}
## AveYo: change steam startup location to Library window and set friendsui perfomance options
dir "$STEAM\userdata\*\7\remote\sharedconfig.vdf" -Recurse |foreach {
$file = $_; $write = $false; $vdf = vdf_parse -vdf (gc $file -force)
vdf_mkdir $vdf["UserRoamingConfigStore"] 'Software\Valve\Steam\FriendsUI'
$key = $vdf["UserRoamingConfigStore"]["Software"]["Valve"]["Steam"]
if ($key["SteamDefaultDialog"] -ne '"#app_games"') { $key["SteamDefaultDialog"] = '"#app_games"'; $write = $true }
$ani = $key["FriendsUI"]["FriendsUIJSON"]
if ($FriendsAnimed -eq 0 -and ($ani -like '*atedAvatars\":true*' -or $ani -like '*RoomEffects\":false*') ) {
$ani = $ani.Replace('atedAvatars\":true','atedAvatars\":false').Replace('RoomEffects\":false','RoomEffects\":true')
$ani = $ani.Replace('PersonaNotifications\":1','PersonaNotifications\":0')
$key["FriendsUI"]["FriendsUIJSON"] = $ani; $write = $true
}
if ($write) { sc-nonew $file $(vdf_print $vdf); write-output " $file " }
}
## AveYo: enable Small Mode and library performance options
$opt = @{LibraryDisableCommunityContent=1; LibraryLowBandwidthMode=1; LibraryLowPerfMode=1; LibraryDisplayIconInGameList=0}
if ($ShowGameIcons -eq 1) {$opt.LibraryDisplayIconInGameList = 1}
dir "$STEAM\userdata\*\config\localconfig.vdf" -Recurse |foreach {
$file = $_; $write = $false; $vdf = vdf_parse -vdf (gc $file -force)
vdf_mkdir $vdf["UserLocalConfigStore"] 'Software\Valve\Steam'
$key = $vdf["UserLocalConfigStore"]["Software"]["Valve"]["Steam"]
if ($key["SmallMode"] -ne '"1"') { $key["SmallMode"] = '"1"'; $write = $true }
foreach ($o in $opt.Keys) { if ($vdf["UserLocalConfigStore"]["$o"] -ne """$($opt[$o])""") {
$vdf["UserLocalConfigStore"]["$o"] = """$($opt[$o])"""; $write = $true
}}
if ($FriendsSignIn -eq 0) {
vdf_mkdir $vdf["UserLocalConfigStore"] 'friends'
$key = $vdf["UserLocalConfigStore"]["friends"]
if ($key["SignIntoFriends"] -ne '"0"') { $key["SignIntoFriends"] = '"0"'; $write = $true }
}
if ($write) { sc-nonew $file $(vdf_print $vdf); write-output " $file " }
}
## AveYo: save to steam if pasted directly into powershell or location / content does not match
$file = "$STEAM\steam_min.ps1"
if ($env:0 -and (test-path -lit $env:0) -and $env:2 -eq 2) {
$c0 = gc -lit $env:0 -ea 0; $c2 = gc -lit $file -ea 0
if (!(test-path $file) -or (compare-object -Ref $c0 -Diff $c2)) { gc -lit $env:0 | set-content -force $file }
} else { ( ## lean and mean bat-ps1 hybrid - AveYo 2025
'@(set "0=%~f0" ''& set 1=%*) & powershell -nop -c "$env:2=2; gc -lit $env:0|out-string|powershell -nop -c -" & exit /b '');.{'+
$($MyInvocation.MyCommand.Definition) + '} #_press_Enter_if_pasted_in_powershell' ) -split'\r?\n' | set-content -force $file
}
## AveYo: refresh Steam_min desktop shortcut
$wsh = new-object -ComObject WScript.Shell
$lnk = $wsh.CreateShortcut("$([Environment]::GetFolderPath('Desktop'))\Steam_min.lnk")
$lnk.Description = "$STEAM\steam.exe"; $lnk.IconLocation = "$STEAM\steam.exe,0"; $lnk.WindowStyle = 7
$lnk.TargetPath = "powershell"; $lnk.Arguments = "-nop -nol -ep remotesigned -file ""$STEAM\steam_min.ps1"""; $lnk.Save()
## AveYo: start Steam with quick launch options
[void]$wsh.Run("""$STEAM\Steam.exe"" $QUICK", 1, "false"); sleep -m 250
## AveYo: cleanup com
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($lnk)
[void][Runtime.InteropServices.Marshal]::ReleaseComObject($wsh)
} #_press_Enter_if_pasted_in_powershell
* text=auto
* eol=crlf
@God-damnit-all
Copy link

Steam Version: 1694466342
Steam Client Build Date: Tue, Sep 12 00:51 UTC -08:00
Steam Web Build Date: Sun, Sep 10 02:01 UTC -08:00
Same. Windows 11 22621.2338

Anyway, it's no longer very helpful in recent steam versions. I have something much effective planned.

Would you happen to know how to scrape the parameters that currently work? The latest copy of the parameters I can find is https://gist.github.com/davispuh/6600880, but Steam broke a whole lot of them in the recent updates.

@AveYo
Copy link
Author

AveYo commented Oct 12, 2023

@ImportTaste I use GetLaunchOptions.bat script
run it once and it will add itself to Send to right-click menu
then, right-click Steam folder, Send to, GetLaunchOptions and it will generate a subfolder _LAUNCHOPTIONS_ with all the exe's and dll's text-mined and a summary @LAUNCH_OPTIONS.ini that opens automatically in notepad
I usually just drag exe and dll of interest in a new folder and do it that way to speed things up

But specifically about Steam, there are no longer useful launch options. The (very-old) chromium behind the scenes is left unchecked and that's why it often leaks / does not release memory.

@God-damnit-all
Copy link

@AveYo on Sep 19

Anyway, it's no longer very helpful in recent steam versions. I have something much effective planned.

Today I learned, through unfortunate circumstances, that @AllowSkipGameUpdate was removed; so, I wanted to ask you about what you said here since I'm quite fed up with the Steam client at this point.

@xamionex
Copy link

xamionex commented Dec 27, 2023

Made the code a little more readable and added some QoL my friends would like :P
Gonna be using this until OpenSteamClient gets remade :D
MiniSteam

@lordamir20132
Copy link

check this out:
https://github.com/Aetopia/NoSteamWebHelper
it works good
after launching a game webhelper will disappear

@God-damnit-all
Copy link

check this out: https://github.com/Aetopia/NoSteamWebHelper it works good after launching a game webhelper will disappear

Does anyone have a solution in March of 2024? Aetopia has stopped updating NoSteamWebHelper, was working fine previously.

Oh god damnit.

@Rafee-M
Copy link

Rafee-M commented Dec 18, 2024

@xamionex could repost the MiniSteam link?

@xamionex
Copy link

xamionex commented Dec 18, 2024

@xamionex
Copy link

This was made almost a year ago, so don't expect everything to work fully, I recommend checking out Steam-Debloat

@Rafee-M
Copy link

Rafee-M commented Dec 18, 2024

Yeah it looks promising and I'll look into it. For now, NoSteamWebHelper has been working quite well. Thanks for the code, I'll check it out!

@AveYo
Copy link
Author

AveYo commented Dec 27, 2024

update: new script to always launch steam in SmallMode

  • reduced ram usage when idle, it's rather lazy (after 15minutes is now 127.9MB on win11)
  • like the old version it adds a Steam_min desktop shortcut + updates startup entry if set
  • using only supported steam launch options and cfg edit, no more ifeo hijacking
  • should not require admin rights, but if it does not work run it once as Admin

the project I talked about that patched the steamui dynamically was more efficient but less reliable
have been using this script instead and everything works normally
I can switch back to Large Mode when needed, and when I start Steam_min next time it is back in Small Mode!

@AveYo
Copy link
Author

AveYo commented Jan 16, 2025

update: made it fully hybrid i.e. can enter raw code into terminal/powershell directly for installation

@God-damnit-all
Copy link

God-damnit-all commented Jan 17, 2025

Shouldn't you be defining $sharedconfig = $true and $localconfig = $true within the loops so the first time it hits a file that switches it to $false it still works?

Here's what I came up with, uses -pv and gets rid of the need for StringBuilders by streaming directly to a variables and joining resulting arrays:

dir "$STEAM\userdata\*\7\remote\sharedconfig.vdf" -pv vdf |foreach {
  $sharedconfig = $true; $t = gc $vdf |foreach {
  if ($_ -match '\s+"SteamDefaultDialog"\s+"') {
    if ($_ -match '#app_games') { $sharedconfig = $false }
    "`t`t`t`t""SteamDefaultDialog""`t`t""#app_games"""
  } else { if ($sharedconfig) { $_ } }  }
  if ($sharedconfig) { set-content $vdf ($t-join"`n") -nonew -force -ea 0; " $vdf" }
}
$re = '\s+"(LibraryLowBandwidthMode|LibraryLowPerfMode|LibraryDisableCommunityContent|LibraryDisplayIconInGameList)"\s+"'
dir "$STEAM\userdata\*\config\localconfig.vdf" -pv vdf |foreach {
  $localconfig = $true; $t = gc $vdf |foreach { if ($_ -notmatch $re) {
  if ($_ -match '\s+"SmallMode"\s+"') {
    if ($_ -match '"1"') { $localconfig = $false }
    "`t`t`t`t""SmallMode""`t`t""1""`n$_"
  } elseif ($localconfig -and $_ -match '\s+"LastPlayedTimesSyncTime"\s+"') {
    "`t`t`t`t""SmallMode""`t`t""1""`n$_"
  } elseif ($localconfig -and $_ -match '\s+"FavoriteServersLastUpdateTime"\s+"') {
    "`t""LibraryDisableCommunityContent""`t`t""1""`n`t""LibraryDisplayIconInGameList""`t`t""0""`n$_"
    "`t""LibraryLowBandwidthMode""`t`t""1""`n`t""LibraryLowPerfMode""`t`t""1""`n$_"
  } else { if ($localconfig) { $_ } }  }}
  if ($localconfig) { set-content $vdf ($t-join"`n") -nonew -force -ea 0; " $vdf" }
}

Also got rid of using sc for set-content since that alias is removed in PowerShell 7 due to conflicting with sc.exe

Oh, and I escaped the quotation marks by doubling them instead of doing `" since that makes it a bit more readable.

@Derbear2112
Copy link

AveYo, you are a lifesaver! This goddamned web "helper" was devouring my network activity and memory, and this is the first fix that has actually worked. thank you very kindly.

@AveYo
Copy link
Author

AveYo commented Feb 12, 2025

@God-damnit-all thank you very much for your feedback!
I actually planned an update to the script, and made it to work in PS 7 just for you!
added a switch that makes it more readable, still using sb for compatibility with PS 2.0
and it's not like one has thousands of active accounts on a tape drive to matter ;)

@Derbear2112 glad to help!

I have updated the script, further changes will probably happen here:

https://github.com/AveYo/Gaming/blob/main/steam_min.bat

@AveYo
Copy link
Author

AveYo commented Jun 10, 2025

updated for latest steam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment