Skip to content

Instantly share code, notes, and snippets.

@computer-catt
Created January 7, 2025 02:51
Show Gist options
  • Select an option

  • Save computer-catt/53241f4f3dfb8fb64b242ef2d889a012 to your computer and use it in GitHub Desktop.

Select an option

Save computer-catt/53241f4f3dfb8fb64b242ef2d889a012 to your computer and use it in GitHub Desktop.
Portable Discord Utility
@echo off
setlocal EnableDelayedExpansion
echo Welcome to Portable Discord Utility
echo by a silly computer cat
:question
if exist "%localappdata%/discord" (
echo Discord is already installed
echo We can exit, delete it, or attempt to migrate everything
set /p userChoice="Do you want to proceed? (fresh/exit/migrate): "
)
if exist "%localappdata%/discord" (
if /i "%userChoice%"=="fresh" (
goto fresh
) else if /i "%userChoice%"=="exit" (
pause
exit
) else if /i "%userChoice%"=="migrate" (
goto migrate
) else (
echo Invalid input.
goto question
)
)
:fresh
echo Killing discord and deleting old discord data
taskkill /IM "Discord.exe" /F
del /s /q "%appdata%/discord"
rmdir /s /q "%appdata%/discord"
echo Creating new discord directories and making links
mkdir "portable/discordData"
mklink /j "%appdata%/discord" "portable/discordData"
mkdir "portable/discord"
echo Downloading Discord installer
curl -o Installer.exe https://stable.dl2.discordapp.net/distro/app/stable/win/x64/1.0.9175/DiscordSetup.exe
Installer.exe
taskkill /IM "Discord.exe" /F
xcopy "%localappdata%/discord" "portable/discord" /e /i
rmdir /s /q "%localappdata%/discord"
mklink /j "%localappdata%/discord" "portable/discord"
echo Discord is now installed in your portable directory.
del Installer.exe
pause
exit
:migrate
echo Migrating the existing instance of discord
taskkill /IM "Discord.exe" /F
mkdir "portable/discord"
xcopy "%localappdata%/discord" "portable/discord" /e /i
rmdir /s /q "%localappdata%/discord"
mklink /j "%localappdata%/discord" "portable/discord"
mkdir "portable/discordData"
xcopy "%appdata%/discord" "portable/discordData"" /e /i
rmdir /s /q "%appdata%/discord"
mklink /j "%appdata%/discord" "portable/discordData"
pause
exit
mklink /j "%localappdata%\discord" "portable\discord"
mklink /j "%appdata%\discord" "portable\discordData"
cd portable/discord
Update.exe --processStart Discord.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment