This topic has been locked
Aldem Sep 23, 2017 @ 12:20pm
Creating desktop shortcuts for multiple games at once.
See topic.

Is it possible ?

Thank you.
< >
Showing 1-9 of 9 comments
Thony Sep 23, 2017 @ 12:21pm 
You want to start over one desktop-shortcut more than 1 game?
Aldem Sep 23, 2017 @ 12:23pm 
Yes. I have quite a lot of games, so right clicking -> create desktop shortcut could take a while.
Thony Sep 23, 2017 @ 12:25pm 
When you mean a script to run all of your games, then I can you say the way to do this.
Aldem Sep 23, 2017 @ 12:27pm 
Well, if an automated tool would create a desktop shortcut for all my games in my library, then yeah, it would work too.
Thony Sep 23, 2017 @ 12:28pm 
Originally posted by Aldem:
Well, if an automated tool would create a desktop shortcut for all my games in my library, then yeah, it would work too.
Mhm... No, sorry, I cann't help you.
luadin Oct 12, 2018 @ 3:12pm 
I recently had an issue where all most my shortcuts were deleted. I found and modified an Autokey script. You need to download Autokey. Then create a file called Autokey.ahk in your steam\steamapps directory and put the code below in it. Run the code and it will create shortcuts on your desktop for all installed games and programs.

It works by looking at the .acf files in the steamapps directory. These are text files with install information. It gets the game name and steam ID number and makes a URL. It tries to guess at an icon to use by looking at the install directory, so the icons may not be correct.

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ArrayCount = _COMMONREDIST,ENBHOST,EDITOR,SETUP,CONFIG,SETTINGS,INSTAL Loop, *, 0, 0 { Icon := "" Name := "NONE" gameID := 0 if RegExMatch(A_LoopFileName, "appmanifest_\d+\.acf") { FileRead, Contents, %A_LoopFileName% Loop { FileReadLine, line, %A_LoopFileName%, %A_Index% if ErrorLevel break IfInString, line, "name" { line := StrReplace(line, "name") line := StrReplace(line, " ") line := StrReplace(line, ":") line := StrReplace(line, "/") line := StrReplace(line, "\") line := StrReplace(line, "*") line := StrReplace(line, "?") line := StrReplace(line, "™") line := StrReplace(line, "’") line := StrReplace(line, "®") StringReplace, line, line, ",,All Name := line } IfInString, line, "appid" { line := StrReplace(line, "appid") line := StrReplace(line, " ") StringReplace, line, line, ",,All StringReplace , line, line, %A_Space%,,All gameID := line } IfInString, line, "installdir" { line := StrReplace(line, "installdir") line := StrReplace(line, " ") StringReplace, line, line, ",,All Loop, Files, %A_WorkingDir%\common\%line%\*.Icon, R { Icon := A_Loopfilefullpath ; break } if (StrLen(Icon) < 3) { Loop, Files, %A_WorkingDir%\common\%line%\*.exe, R { StringUpper, PATH, A_Loopfilefullpath Good := 1 Loop, parse, ArrayCount, `, { IfInString, PATH, %A_LoopField% { Good := 0 } } if Good = 1 { Icon := PATH ; break } } } } } if (StrLen(Icon) < 3) { Icon := "d:\steam\steam.exe" ; } ; msgbox, 4, ,DEBUG Name <%A_Desktop%\Steam\%Name%.url>, ID <steam://rungameid/%gameID%>, Icon <%Icon%> ; IfMsgBox, No ; return IniWrite, steam://rungameid/%gameID%, %A_Desktop%\%Name%.url, InternetShortcut, URL sleep, 20 IniWrite, %Icon%, %A_Desktop%\%Name%.url, InternetShortcut, IconFile sleep, 20 IniWrite, 0, %A_Desktop%\%Name%.url, InternetShortcut, IconIndex } } MsgBox, Finished
AlgorithMan Jul 18, 2022 @ 4:48pm 
Based on luadins answer, I wrote a corresponding tool in python, because that is much more common than Autokey.

import os import glob import re steamdir = 'F:\Games\Steam' forbidden_ico = ['HEIGHT2NORMAL', 'WHESTART'] forbidden_exe = ['COMMON REDIST','ENBHOST','EDITOR','SETUP','CONFIG','SETTINGS','INSTAL'] os.chdir(steamdir) desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop') for filename in glob.glob('SteamApps/appmanifest_*.acf'): Icon = None Name = None gameID = None f = open(filename, 'r', encoding="utf-8") for line in f: # Name m = re.search('^\s*"name"\s*"([^"]*)"\s*$', line) if m: Name = m.group(1) Name = re.sub(r"[\:\\\/\*\?\’™®\t\"\&]+","", Name).strip() # AppId m = re.search('^\s*"appid"\s*"([^"]*)"\s*$', line) if m: gameID = m.group(1) # Icon m = re.search('^\s*"installdir"\s*"([^"]*)"\s*$', line) if m: IcoIcon = None ExeIcon = None InstallDir = m.group(1) for icofile in glob.glob('SteamApps/common/' + InstallDir + '/**/*.ico', recursive=True): if not any(map(lambda x: x.casefold() in icofile.casefold(), forbidden_ico)): IcoIcon = icofile break for exefile in glob.glob('SteamApps/common/' + InstallDir + '/**/*.exe', recursive=True): if not any(map(lambda x: x.casefold() in exefile.casefold(), forbidden_exe)): ExeIcon = exefile break Icon = IcoIcon or ExeIcon or os.path.join(steamdir, "steam.exe") if not os.path.exists(os.path.join(desktop, Name + ".url")): print(gameID + ": " + Name + " - " + Icon) ico = open(os.path.join(desktop, Name + ".url"), "w") ico.write("[InternetShortcut]\n") ico.write("URL=steam://rungameid/" + gameID + "\n") ico.write("IconFile=" + os.path.join(steamdir, Icon.replace('/', '\\')) + "\n") ico.write("IconIndex=0") ico.close() input()
You have to press Return after each file. Just remove the "input()" at the end to proceed without pause
Terwilf Dec 10, 2024 @ 12:33pm 
Honestly, I wasn't convinced about downloading an interpreter just to create shortcuts. So, I created a PowerShell script. I don't understand why Steam doesn't have an option like this. I always forget about the games I have installed, since I don't launch the Steam client with my system.

Automatic detection: Identifies and accesses all configured Steam libraries.
Direct access to games: Creates shortcuts to the "common" folder and installed games on the desktop.
Icon assignment: Filters and selects the most suitable .exe file to assign custom icons.
  • Initial filtering by name.
  • Exclusion of installers.
  • Partial name matching.
  • Sorting by directory depth.
  • Icon verification and .ico file search

(Steam shortcuts > Run with Powershell)
Add-Type -AssemblyName System.Windows.Forms # Ruta del archivo libraryfolders.vdf $libraryFoldersPath = "C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf" # Función para obtener las rutas de las bibliotecas de Steam function Get-SteamLibraryPaths { param ( [string]$libraryFoldersPath ) $libraryPaths = @() $content = Get-Content -Path $libraryFoldersPath -Raw $matches = [regex]::Matches($content, '"path"\s+"([^"]+)"') foreach ($match in $matches) { $libraryPaths += $match.Groups[1].Value } return $libraryPaths } # Obtener las rutas de las bibliotecas de Steam $steamLibraryPaths = Get-SteamLibraryPaths -libraryFoldersPath $libraryFoldersPath # Ruta del icono predeterminado de Steam $defaultSteamIconPath = "C:\Program Files (x86)\Steam\steam.exe" # Ruta donde se crearán los accesos directos $shortcutsPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath('Desktop'), 'Steam Enlaces') # Crear la carpeta de accesos directos si no existe if (-Not (Test-Path -Path $shortcutsPath)) { New-Item -ItemType Directory -Path $shortcutsPath -Force } # Función para obtener el nombre, appid y installdir de los archivos .acf function Get-SteamGameInfo { param ( [string]$acfFilePath ) $content = Get-Content -Path $acfFilePath -Encoding UTF8 $name = ($content | Select-String -Pattern '"name"' -SimpleMatch).Line.Split('"')[3] $appid = ($content | Select-String -Pattern '"appid"' -SimpleMatch).Line.Split('"')[3] $installdir = ($content | Select-String -Pattern '"installdir"' -SimpleMatch).Line.Split('"')[3] return [PSCustomObject]@{ Name = $name; AppID = $appid; InstallDir = $installdir } } # Función para crear un acceso directo a Internet (.url) function Create-InternetShortcut { param ( [string]$name, [string]$url, [string]$iconPath ) # Reemplazar caracteres especiales en el nombre del archivo $safeName = $name -replace '[<>:"/\\|?*]', '' $shortcutPath = "$shortcutsPath\$safeName.url" $shortcutContent = @" [{000214A0-0000-0000-C000-000000000046}] Prop3=19,0 [InternetShortcut] IDList= IconIndex=0 URL=$url IconFile=$iconPath HotKey=0 "@ Set-Content -Path $shortcutPath -Value $shortcutContent -Encoding UTF8 } # Función para crear un acceso directo a una carpeta function Create-FolderShortcut { param ( [string]$name, [string]$folderPath ) # Reemplazar caracteres especiales en el nombre del archivo $safeName = $name -replace '[<>:"/\\|?*]', '' $shortcutPath = "$shortcutsPath\$safeName.lnk" $wshShell = New-Object -ComObject WScript.Shell $shortcut = $wshShell.CreateShortcut($shortcutPath) $shortcut.TargetPath = $folderPath $shortcut.Save() } # Función para comprobar si el ejecutable es un instalador function Check-Installer { param ( [string]$executablePath ) $isInstaller = $false try { $fileVersionInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($executablePath) if ($fileVersionInfo.FileDescription -match "Setup|InstallShield|Installer") { $isInstaller = $true } } catch { $isInstaller = $false } return $isInstaller } # Función para encontrar el ejecutable correcto function Find-Executable { param ( [string]$gamePath, [string]$name ) $executables = Get-ChildItem -Path $gamePath -Filter *.exe -Recurse $filteredExecutables = $executables | Where-Object { $_.Name[0] -eq $name[0] -and $_.Name -notmatch "Setup|InstallShield" } $filteredExecutables = $filteredExecutables | Where-Object { -not (Check-Installer -executablePath $_.FullName) } if ($filteredExecutables.Count -gt 1) { $filteredExecutables = $filteredExecutables | Where-Object { $_.Name -like "*$($name.Split(' ')[0])*" } } if ($filteredExecutables.Count -gt 1) { $filteredExecutables = $filteredExecutables | Sort-Object { $_.FullName.Split('\').Count } } if ($filteredExecutables.Count -eq 0) { return $null } return $filteredExecutables[0].FullName } # Código para contar iconos $code = @' using System; using System.Runtime.InteropServices; namespace System { public class FileIconInfo { [DllImport("Shell32.dll", EntryPoint = "ExtractIconExW", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int ExtractIconEx( string lpszFile, int nIconIndex, out IntPtr phiconLarge, out IntPtr phiconSmall, int nIcons); } } '@ Add-Type -TypeDefinition $code # Función para comprobar si el ejecutable tiene un icono function Check-ExecutableIcon { param ( [string]$executablePath ) [System.IntPtr] $phiconSmall = 0 [System.IntPtr] $phiconLarge = 0 $hasIcon = $false try { $nImages = [System.FileIconInfo]::ExtractIconEx($executablePath, -1, [ref] $phiconLarge, [ref] $phiconSmall, 0) if ($nImages -gt 0) { $hasIcon = $true } } catch { $hasIcon = $false } return $hasIcon } # Función para encontrar el icono del ejecutable o un archivo .ico en el directorio del juego function Get-ExecutableIcon { param ( [string]$gamePath, [string]$executablePath ) $iconPath = $null if (Check-ExecutableIcon -executablePath $executablePath) { $iconPath = $executablePath } else { $icoFile = Get-ChildItem -Path $gamePath -Filter *.ico -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 if ($icoFile) { $iconPath = $icoFile.FullName } else { $iconPath = $defaultSteamIconPath # Icono por defecto si no se encuentra un .ico } } return $iconPath } # Procesar cada archivo .acf foreach ($libraryPath in $steamLibraryPaths) { $acfFilesPath = [System.IO.Path]::Combine($libraryPath, 'steamapps') $acfFiles = Get-ChildItem -Path $acfFilesPath -Filter *.acf foreach ($acfFile in $acfFiles) { $gameInfo = Get-SteamGameInfo -acfFilePath $acfFile.FullName $gamePath = Join-Path -Path $libraryPath -ChildPath "steamapps\common\$($gameInfo.InstallDir)" $executable = Find-Executable -gamePath $gamePath -name $gameInfo.Name if ($executable) { $iconPath = Get-ExecutableIcon -gamePath $gamePath -executablePath $executable } else { $iconPath = $defaultSteamIconPath # Icono por defecto si no se encuentra el ejecutable } $url = "steam://rungameid/$($gameInfo.AppID)" Create-InternetShortcut -name $gameInfo.Name -url $url -iconPath $iconPath } } # Crear un acceso directo a la carpeta "common" $commonPath = "E:\SteamLibrary\steamapps\common" Create-FolderShortcut -name "Steam Common Folder" -folderPath $commonPath # Mostrar mensaje al finalizar todas las operaciones $result = [System.Windows.Forms.MessageBox]::Show("¡Operación completad! ¿Te gustaría explorar el directorio de iconos de tus juegos de Steam?", "Operación Completada", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Information) if ($result -eq [System.Windows.Forms.DialogResult]::Yes) { Start-Process "explorer.exe" "C:\Program Files (x86)\Steam\steam\games" }
Last edited by Terwilf; Dec 10, 2024 @ 12:39pm
Steve Dec 10, 2024 @ 2:07pm 
This thread was quite old before the recent post, so we're locking it to prevent confusion.
< >
Showing 1-9 of 9 comments
Per page: 1530 50

Date Posted: Sep 23, 2017 @ 12:20pm
Posts: 9