Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Add .venv/Scripts to User PATH so unsloth-studio works without activation

Roland Tannous9eb0ff074b50
diff --git a/setup.ps1 b/setup.ps1
index 07dff2090fb..265b13eb353 100644
--- a/setup.ps1
+++ b/setup.ps1
@@ -806,7 +806,7 @@ function unsloth-ui { & "$VenvPython" "$CliScript" studio -f "$FrontendDist"
Write-Host "[OK] Aliases 'unsloth-studio' and 'unsloth-ui' already exist in $PROFILE" -ForegroundColor Green
}
-# --- cmd.exe: create batch files on PATH so they work from regular terminal ---
+# --- cmd.exe: create batch files and ensure they're on PATH ---
$BatDir = Join-Path $RepoDir ".venv\Scripts"
foreach ($name in @("unsloth-studio", "unsloth-ui")) {
$batPath = Join-Path $BatDir "$name.bat"
@@ -814,7 +814,17 @@ foreach ($name in @("unsloth-studio", "unsloth-ui")) {
Set-Content -Path $batPath -Value "@echo off`r`n`"$VenvPython`" `"$CliScript`" studio -f `"$FrontendDist`" %*"
}
}
-Write-Host "[OK] Batch launchers created in $BatDir (works from cmd.exe when venv is on PATH)" -ForegroundColor Green
+# Persist .venv\Scripts to User PATH so commands work in new cmd.exe terminals without activation
+$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
+if (-not $userPath -or $userPath -notlike "*$BatDir*") {
+ if ($userPath) {
+ [Environment]::SetEnvironmentVariable('Path', "$BatDir;$userPath", 'User')
+ } else {
+ [Environment]::SetEnvironmentVariable('Path', "$BatDir", 'User')
+ }
+ Write-Host " Persisted $BatDir to User PATH" -ForegroundColor Gray
+}
+Write-Host "[OK] Batch launchers created (works from any new cmd.exe or PowerShell)" -ForegroundColor Green
# ============================================
# Done