Portable Version Instruction by Royi

Very necessary! I tried the method with substitution through BAT. But if I launch a link in a browser from Obsidian, then a new profile is created. And all the cache and garbage from the browser ends up in my folder! This is bad :frowning:

The problem is I am not sure which env variable is used by Obsidian to locate the user profile folder.
Since many env variables are changed, when you launch the browser it will see an empty APPDATA folder and will recreate a profile folder.

It seems to exclusively use %USERPROFILE% as a root path. I was able to reduce your launcher down to:

@echo off
:: Setting Env Variables
set "USERPROFILE=%~dp0User"
set "TEMP=%USERPROFILE%\AppData\Local\Temp"
set "TMP=%USERPROFILE%\AppData\Local\Temp"

:: Creating Folders
if not exist "%USERPROFILE%\AppData\Roaming" mkdir "%USERPROFILE%\AppData\Roaming"
if not exist "%USERPROFILE%\Documents" mkdir "%USERPROFILE%\Documents"
if not exist "%USERPROFILE%\AppData\Local\Temp" mkdir "%USERPROFILE%\AppData\Local\Temp"

start "" "%~dp0Obsidian.exe"

and in my limited testing it works without issue.

Since writing to flashdrives is usually slower, you could probably leave the temp variables alone. Although to be compliant with the portableapps standard, you subpath them to %LOCALAPPDATA%\Obsidian\Temp on the OS drive so any temp files generated can be cleanly removed on shutdown.

1 Like