Skip to content

Instantly share code, notes, and snippets.

@Knewest
Last active March 25, 2025 08:39
Reinstall BetterDiscord seconds after Discord uninstalls it against your will. Avoid using the time consuming installer with this trick.

How to make BetterDiscord easier to install repeatedly:

  1. Download and install these two CLI tools:

  2. Create a permanent folder on your file explorer named something like BetterDiscordReinstall.

  3. Depending on your Discord client, place the two batch programs in the folder:

    Stable Discord:

    Discord Public Test Build:

    Discord Canary:

  1. For the initial setup, run the FullyReinstallBetterDiscord.bat batch program and a BetterDiscord folder will be created within the folder.
  1. If BetterDiscord ever uninstalls itself, run the QuickReinstallBetterDiscord.bat batch program and it will bring BetterDiscord back within a literal second.

  2. Ideally, right click the folder you created and pin it to the quick access bar so you can quicky reinstall BetterDiscord if it is uninstalled by Discord:

    https://cdn.discordapp.com/attachments/1071870103513210990/1104006791651672114/IeTG4OyRpc.webp


    Note:
    If QuickReinstallBetterDiscord.bat ever stops working, just rerun the FullyReinstallBetterDiscord.bat batch program to hopefully fix it. If this doesn't work either, Discord may have broken BetterDiscord and you will need to wait for BetterDiscord to release a patch/update addressing it.



Thank you for using my guide, I hope it helps greatly. Now you no longer have use the installer over and over again, which is time consuming.
- Knew
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord Canary.lnk
taskkill /F /IM DiscordCanary.exe
if exist "%START_MENU_PATH%" (
git clone https://github.com/BetterDiscord/BetterDiscord.git
cd betterdiscord
npm install -g pnpm
pnpm install
pnpm build
pnpm inject canary
start "" "%START_MENU_PATH%"
)
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord Canary.lnk
taskkill /F /IM DiscordCanary.exe
if exist "%START_MENU_PATH%" (
cd betterdiscord
pnpm inject canary
start "" "%START_MENU_PATH%"
)
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord PTB.lnk
taskkill /F /IM DiscordPTB.exe
if exist "%START_MENU_PATH%" (
git clone https://github.com/BetterDiscord/BetterDiscord.git
cd betterdiscord
npm install -g pnpm
pnpm install
pnpm build
pnpm inject ptb
start "" "%START_MENU_PATH%"
)
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord PTB.lnk
taskkill /F /IM DiscordPTB.exe
if exist "%START_MENU_PATH%" (
cd betterdiscord
pnpm inject ptb
start "" "%START_MENU_PATH%"
)
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk
taskkill /F /IM Discord.exe
if exist "%START_MENU_PATH%" (
git clone https://github.com/BetterDiscord/BetterDiscord.git
cd betterdiscord
npm install -g pnpm
pnpm install
pnpm build
pnpm inject
start "" "%START_MENU_PATH%"
)
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk
taskkill /F /IM Discord.exe
if exist "%START_MENU_PATH%" (
cd betterdiscord
pnpm inject
start "" "%START_MENU_PATH%"
)
@bitingsock
Copy link

I suggest cd %~dp0betterdiscord in case the script is ran from another CWD

@xcloudx01
Copy link

Works great! Thank you so much

@renatamer
Copy link

The fact that we still need this is insane. Thanks for your work.

@Andziaa
Copy link

Andziaa commented Dec 17, 2024

thank you for doing gods work

@NEVERGOONCHUD
Copy link

its ight but powershell is newer or something of the likes

@Knewest
Copy link
Author

Knewest commented Jan 12, 2025

its ight but powershell is newer or something of the likes

It doesn't matter.

@imwaitingnow
Copy link

if anyone is getting 'bun' is not recognized as an internal or external command, operable program or batch file
edit the fullreinstallbetterdiscord.bat with npm install -g bun ive made the revisions here

https://gist.github.com/imwaitingnow/0cec78c7b1e7c2aeffecc5af7abedffd/revisions

@NEVERGOONCHUD
Copy link

NEVERGOONCHUD commented Feb 12, 2025

Regarding all FullyReinstallBetterDiscord.bat files, a git error saying "cannot lock ref" occurs.
To fix, add:
git gc --prune=now
git remote prune origin
if cloning the repository fails.

@Knewest
Copy link
Author

Knewest commented Feb 25, 2025

I seriously need to update this, and modify it to use the official BetterDiscord CLI. I should perhaps just incorporate and automatic set-up installer to pre-set everything correctly. Ah.., motivation.. where are you? Behind my studies, I suppose..

@JeremyD357
Copy link

JeremyD357 commented Feb 25, 2025

Hey also add Bun to the script i made some change to the full install script it look like this

set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk

taskkill /F /IM Discord.exe

if exist "%START_MENU_PATH%" (
	git clone https://github.com/BetterDiscord/BetterDiscord.git
    cd betterdiscord
	powershell -c "irm bun.sh/install.ps1 | iex"
	pnpm approve-builds
	npm install -g pnpm
	npm update -g
	pnpm install
	pnpm build
	git gc --prune=now
	git remote prune origin
    pnpm inject
    start "" "%START_MENU_PATH%"
)

Does it look good for you ?

@doggeddalle
Copy link

Hey also add Bun to the script i made some change to the full install script it look like this

set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk

taskkill /F /IM Discord.exe

if exist "%START_MENU_PATH%" (
	git clone https://github.com/BetterDiscord/BetterDiscord.git
    cd betterdiscord
	powershell -c "irm bun.sh/install.ps1 | iex"
	pnpm approve-builds
	npm install -g pnpm
	npm update -g
	pnpm install
	pnpm build
	git gc --prune=now
	git remote prune origin
    pnpm inject
    start "" "%START_MENU_PATH%"
)

Does it look good for you ?

@echo off
set START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk

:: Kill Discord if running
taskkill /F /IM Discord.exe 2>nul

:: Check if Discord is installed
if not exist "%START_MENU_PATH%" (
    echo Discord is not installed. Exiting...
    exit /b
)

:: Clone BetterDiscord only if it doesn't exist
if not exist "BetterDiscord" (
    git clone https://github.com/BetterDiscord/BetterDiscord.git
)

cd BetterDiscord || exit /b

:: Ensure pnpm is installed
where pnpm >nul 2>nul
if %errorlevel% neq 0 (
    npm install -g pnpm
)

:: Install dependencies
pnpm install
pnpm approve-builds
pnpm build

:: Inject BetterDiscord
pnpm inject

:: Start Discord
start "" "%START_MENU_PATH%"

@speedlorenzo12
Copy link

speedlorenzo12 commented Mar 4, 2025

you need to prevent the code from installing the pre release using an option in the code for example

@doggeddalle
Copy link

Full reinstall edited for "Stable"

@echo off
REM ================================
REM BetterDiscord Full Installation
REM ================================

REM Define the path to the Discord shortcut in the Start Menu
set "START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk"

REM Stop Discord if it is running
echo Stopping Discord...
taskkill /F /IM Discord.exe >nul 2>&1

REM Ensure Discord is installed (via the Start Menu shortcut)
if exist "%START_MENU_PATH%" (
    REM Check if BetterDiscord folder exists
    if not exist "betterdiscord" (
        echo Cloning BetterDiscord repository...
        git clone https://github.com/BetterDiscord/BetterDiscord.git || (
            echo [Error] Git clone failed.
            pause
            exit /b 1
        )
    ) else (
        echo "betterdiscord" folder already exists. Updating repository...
        pushd betterdiscord
        git pull || (
            echo [Error] Git pull failed.
            pause
            popd
            exit /b 1
        )
        popd
    )

    REM Change directory into the repository folder
    pushd betterdiscord

    REM Check if pnpm is installed globally; if not, install it
    npm list -g pnpm >nul 2>&1
    if errorlevel 1 (
        echo Installing pnpm...
        npm install -g pnpm || (
            echo [Error] Failed to install pnpm.
            pause
            popd
            exit /b 1
        )
    ) else (
        echo pnpm is already installed.
    )

    echo Installing dependencies...
    pnpm install || (
        echo [Error] Dependency installation failed.
        pause
        popd
        exit /b 1
    )

    echo Building BetterDiscord...
    pnpm build || (
        echo [Error] Build failed.
        pause
        popd
        exit /b 1
    )

    echo Injecting BetterDiscord into Discord...
    pnpm inject || (
        echo [Error] Injection failed.
        pause
        popd
        exit /b 1
    )

    popd

    echo Starting Discord...
    start "" "%START_MENU_PATH%"
) else (
    echo Discord shortcut not found. Please ensure Discord is installed.
    pause
)

QuickReinstall edited for 'Stable'

@echo off
REM ================================
REM BetterDiscord Quick Reinstall
REM ================================

set "START_MENU_PATH=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk"

echo Stopping Discord...
taskkill /F /IM Discord.exe >nul 2>&1

if exist "%START_MENU_PATH%" (
    if exist "betterdiscord" (
        pushd betterdiscord
        echo Re-injecting BetterDiscord...
        pnpm inject || (
            echo [Error] Injection failed.
            pause
            popd
            exit /b 1
        )
        popd
        echo Starting Discord...
        start "" "%START_MENU_PATH%"
    ) else (
        echo BetterDiscord folder not found. Please run the full installation script first.
        pause
    )
) else (
    echo Discord shortcut not found. Please ensure Discord is installed.
    pause
)

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