Windows - Portable Install & Update via batch file

Hi, I used the @Malthael_82 posts on this thread and asked AI to generate a step by step instructions.
If something is wrong, please correct it by commenting.


What You’ll Need

  • A Windows PC with PowerShell installed (comes with Windows 10/11)

  • 7-Zip installed on your system

  • An internet connection (for the auto-download script)


Step 1 — Create Your Portable Folder

Create a new folder anywhere you want Obsidian to live. It can be on your local drive, an external drive, or a USB stick. For this guide we’ll call it:

ObsidianPortable\

This folder is self-contained — everything Obsidian needs will live inside it.


Step 2 — Copy 7-Zip Files Into the Folder

Locate your 7-Zip installation (usually C:\Program Files\7-Zip\) and copy these files directly into your ObsidianPortable\ folder:

  • 7z.exe

  • 7z.dll

  • 7-zip.dll

  • 7-zip32.dll

  • License.txt

These are required because the script uses 7-Zip to extract Obsidian from its installer.


Step 3 — Create the Batch File

Inside ObsidianPortable\, create a new text file and name it ObsidianPortable.bat (make sure the extension is .bat, not .txt).

Open it with Notepad and paste the following script — this is the April 30th automated version that checks for updates and downloads automatically:

@echo off
%~d0
cd %~dp0

SET /a installed=0
IF EXIST "Obsidian" (
	SET /a installed=1
)
echo Obsidian installed: %installed%

SET /a installer=0

SET /a vermismatch=0

:: --- CONFIGURATION ---
set "repo=obsidianmd/obsidian-releases"
:: ---------------------

:: Fetch latest release data and extract the tag_name
FOR /F "usebackq tokens=*" %%v IN (`pwsh -NoProfile -Command "(Invoke-RestMethod -Uri 'https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest').tag_name"`) DO ( SET "version=%%v" )

:: Clean up the version string (remove leading "v")
SET "version=%version: =%"
SET "version=%version:~1%"

ECHO New Version: %version%
	
IF %installed% EQU 1 (
	FOR /F "usebackq tokens=*" %%i IN (`pwsh -NoProfile -Command "(Get-Item '.\Obsidian\Obsidian.exe').VersionInfo.ProductVersion"`) DO ( SET "installedver=%%i" )
)

IF NOT DEFINED installedver (
	SET "installedver=not"
) ELSE (
	IF "%installedver:~-2%" == ".0" (
		SET installedver=%installedver:~0,-2%
	)
)

SET "installedver=%installedver: =%"

ECHO Installed Version: %installedver%
	
IF "%version%" == "%installedver%" (
	ECHO Installed version same as latest available.
) ELSE (
	SET /a vermismatch=1
)

:: Installing Obsidian from Obsidian-VersionNumber.exe
IF %vermismatch% EQU 1 (
	FOR /F "usebackq tokens=*" %%u IN (`pwsh -NoProfile -Command "(Invoke-RestMethod -Uri 'https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest').assets | Where-Object { $_.name -like '*Obsidian*.exe' } | Select-Object -ExpandProperty browser_download_url"`) DO ( SET "download_url=%%u" )
)

IF NOT DEFINED download_url (
	ECHO Download path not found
) ELSE (
	ECHO Downloading from: %download_url%
	curl -L -O %download_url%
)

IF EXIST ".\Obsidian-*.exe" (
	SET /a installer=1
	
	ECHO Obsidian installer present: %installer%
	
	FOR /F "TOKENS=*" %%F IN ('DIR /B "Obsidian-*.exe"') DO 7z e "%%~fF" -r app-64.7z
	DEL Obsidian-*.exe /Q
	7z x -aoa -o".\Obsidian\" app-64.7z
	DEL app-64.7z /Q
) ELSE (
	IF %installed% EQU 0 (
		ECHO Obsidian installer not found.
		ECHO Obsidian not installed.
		ECHO Please try again, or manually download the installer and place it in this directory.
		PAUSE
		EXIT
	)
)

IF EXIST "Obsidian" (
	:: Creating Folders
	IF NOT EXIST "%~dp0User" MKDIR "%~dp0User"
	IF NOT EXIST "%~dp0User\AppData" MKDIR "%~dp0User\AppData"
	IF NOT EXIST "%~dp0User\AppData\Roaming" MKDIR "%~dp0User\AppData\Roaming"
	IF NOT EXIST "%~dp0User\Desktop" MKDIR "%~dp0User\Desktop"
	IF NOT EXIST "%~dp0User\Documents" MKDIR "%~dp0User\Documents"

	:: Setting Env Variables
	SET HOMEPATH=%~dp0User
	SET USERPROFILE=%~dp0User
	SET APPDATA=%~dp0User\AppData
	SET ALLUSERSPROFILE=%~dp0User\ProgramData\Roaming
	SET ALLUSERSAPPDATA=%~dp0User\AppData

	GOTO :message

	:message
	ECHO PORTABLE Obsidian
	ECHO -------------------------------
	GOTO :start

	:start
	START .\Obsidian\Obsidian.exe
	GOTO :end
) ELSE (
	ECHO Obsidian not installed
	ECHO Please put Obsidian-x.y.z.exe file in this directory
	PAUSE
)

:end
EXIT

Save the file.


Step 4 — Run the Batch File

Double-click ObsidianPortable.bat.

The script will automatically:

  1. Check the latest Obsidian version on GitHub

  2. Compare it with what’s currently installed (if anything)

  3. Download the installer if needed

  4. Extract Obsidian into the Obsidian\ subfolder

  5. Create the User\ folder structure for your profile data

  6. Set environment variables so Obsidian thinks the portable folder is its home

  7. Launch Obsidian


Step 5 — Understand the Resulting Folder Structure

After the first run, your ObsidianPortable\ folder will look like this:

ObsidianPortable\
├── ObsidianPortable.bat       ← Your launcher (run this every time)
├── 7z.exe / 7z.dll / etc.    ← 7-Zip files
├── Obsidian\                  ← Obsidian app files (extracted)
│   └── Obsidian.exe
└── User\
    ├── AppData\
    │   └── Roaming\           ← Settings, plugins, themes stored here
    ├── Desktop\
    └── Documents\
        └── Obsidian Vaults\   ← Your vaults live here

Everything — settings, plugins, vaults — stays inside ObsidianPortable\. Nothing touches your Windows user profile.


Step 6 — Launching Obsidian Going Forward

Always launch Obsidian by running ObsidianPortable.bat, never by clicking Obsidian.exe directly. The batch file is what sets the correct environment variables to keep everything portable and self-contained.


Updating Obsidian

Simply run ObsidianPortable.bat again. It will automatically detect if a newer version is available, download it, extract it over the existing installation, and launch the updated version. No manual steps needed.


Tips

  • Moving to another PC or drive? Just copy the entire ObsidianPortable\ folder. Run the .bat file and everything works as-is.

  • No admin rights needed — since nothing is “installed” in the traditional sense, the script just extracts files.

  • Vaults can be placed anywhere inside User\Documents\ or pointed to any external folder when you set them up in Obsidian.