Skip to content

Instantly share code, notes, and snippets.

@sparr
Last active December 11, 2022 21:03
Show Gist options
  • Save sparr/f8b57bee36b29e4274acafb4a06aeaaf to your computer and use it in GitHub Desktop.
Save sparr/f8b57bee36b29e4274acafb4a06aeaaf to your computer and use it in GitHub Desktop.
Bash script to rename/symlink SkyrimSELauncher.exe and skse64_loader.exe to enable/disable SKSE for launch via Steam.
#!/bin/bash
# This script manipulates SkyrimSELauncher.exe and skse64_loader.exe so that
# tools like Steam that expect to run SkyrimSELauncher.exe will transparently
# run skse64_loader.exe instead.
# When SKSE is "enabled", SkyrimSELauncher.exe will have been renamed to
# SkyrimSELauncher.exe.orig and replaced with a symlink to skse64_loader.exe
# When SKSE is "disabled", that symlink will be named SkyrimSELauncher.exe.skse
if [ -f "SkyrimSELauncher.exe.skse" ]; then
# skse disabled. enable it.
mv "SkyrimSELauncher.exe" "SkyrimSELauncher.exe.orig" &&
mv "SkyrimSELauncher.exe.skse" "SkyrimSELauncher.exe" &&
echo "SKSE now enabled" &&
exit 0 ||
echo "Failed to enable SKSE" &&
exit 1
elif [ -f "SkyrimSELauncher.exe.orig" ]; then
# skse enabled. disable it.
mv "SkyrimSELauncher.exe" "SkyrimSELauncher.exe.skse" &&
mv "SkyrimSELauncher.exe.orig" "SkyrimSELauncher.exe" &&
echo "SKSE now disabled" &&
exit 0 ||
echo "Failed to disable SKSE" &&
exit 1
elif [ -f "skse64_loader.exe" ]; then
# skse symlink not set up. set it up and enable it.
mv "SkyrimSELauncher.exe" "SkyrimSELauncher.exe.orig" &&
ln -s "skse64_loader.exe" "SkyrimSELauncher.exe" &&
echo "SKSE symlink set up and enabled" &&
exit 0 ||
echo "Failed to set up SKSE symlink and enable it" &&
exit 1
else
echo "skse64_loader.exe is missing, cannot proceed"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment