Last active
October 27, 2023 21:46
-
-
Save sonic2kk/ecc60bcc4b071e33098c00e4e27c919c to your computer and use it in GitHub Desktop.
Get all Steam Shortcut Exe paths using Bash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Magic that represents 'exe' column begin and end | |
# Should always be Exe, but you could account for 'exe' with '6578650a' | |
magic_exe_camelcase="000145786500" # 'Exe' | |
magic_exe_end="0001" # end bytes before next column begins | |
# Paste in your Steam UserID | |
steam_userid="" | |
shortcuts_vdf="$HOME/.steam/root/userdata/${steam_userid}/config/shortcuts.vdf" | |
# Get all Steam Shortcut exe values (all values between the magic start and end bytes) | |
mapfile -t non_steam_exes < <(xxd -p -c 0 "$shortcuts_vdf" | grep -oP "${magic_exe_camelcase}\K.*?(?=0001)" ) | |
# Convert from hex and print in loop with trimmed null byte | |
# exe will usually contain quotes even when added by Steam itself, though when you browse for exe with Steam, it will remove the quotes | |
# You could trim the start and end quotes with - sed -e 's/^"//' -e 's/"$//' | |
# This will simply print them as-is, whether they have quotes or not | |
for i in "${non_steam_exes[@]}"; do | |
steam_shortcut_exe="$( printf "%s\n" "$i" | xxd -r -p | tr -d '\0' )" | |
echo "exe: ${steam_shortcut_exe}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment