Portable VS Code & VSCodium Manager
A self-contained PowerShell 7.x manager for installing, preconfiguring, updating, backing up, and uninstalling Portable Mode copies of Microsoft VS Code and VSCodium (Stable & Insiders) on Windows—with non-admin HKCU Explorer context menus, User PATH integration, opt-in .ini profiles, and automatic portable toolchain dependencies.
Start here
| Need | Documentation |
|---|---|
| Install your first portable editor | Getting started |
Customize config.ini and editor.ini | Configuration |
Enable optional profiles (privacy, no-ai, low-end, ext-*) | Optional profiles & extension packs |
| Script or automate installs, updates, and backups | CLI reference |
Understand portable toolchains (git, ripgrep, python, node, etc.) | Extension dependencies & portable toolchains |
Fix PowerShell 7, Todo Tree, or PATH issues | Troubleshooting |
| Understand the 4-layer PowerShell 7 architecture | Architecture |
| Look up internal module functions | Module & function API reference |
| Add new profiles, tools, or editor editions | Extending |
Understand release .zip packaging rules | Release packaging |
Design boundaries
- PowerShell 7.x required: All entrypoints enforce
#Requires -Version 7.0; legacy Windows PowerShell 5.1 is not supported. - Zero Administrator elevation: Context menus, User
PATH, and official per-program registry keys are written strictly underHKCUvia.NET[Microsoft.Win32.Registry]. - Opt-in INI profiles: Optional profiles under
profiles\*.iniare loaded only when referenced inconfig.ini,-Preset, or interactive menus. - 100% portable toolchains: Missing extension dependencies are downloaded from official upstream Windows x64 portable builds and wired directly into
PATH,HKCU, andsettings.json.
Getting Started
This guide walks you through installing and managing a self-contained portable copy of Microsoft VS Code or VSCodium on Windows.
Prerequisites
- Windows 10 / 11 (x64)
- PowerShell 7.x (
pwsh.exe) inPATH- This project intentionally requires PowerShell 7.0+ (
#Requires -Version 7.0) because Windows PowerShell 5.1 is being phased out. - Install PowerShell 7 via winget:
winget install Microsoft.PowerShell - Or download the portable Windows x64 ZIP from PowerShell/PowerShell Releases.
- This project intentionally requires PowerShell 7.0+ (
- No Administrator privileges required: All context menus,
PATHentries, and per-program tool registry entries are written under your user account (HKCU/ UserPATH).
First Installation via main.bat
- Extract the release archive (or clone the repository) to a folder of your choice.
- (Optional) Review
config.inito customize:DefaultInstallDir(e.g.,D:\IDE\{program_name})DefaultToolsDir(e.g.,D:\CLI\{tool_name})DefaultProduct(vscodeorvscodium) andDefaultChannel(stableorinsiders)OptionalProfiles(e.g.,portable-essentials, privacy, no-ai, low-end, ext-general)EditorConfigFile(e.g.,editor.inifor your own custom settings/extensions)
- Double-click
main.bat(or runmain.bat "D:\IDE\VSCode"from a terminal to override the target folder). - Choose Option 1 — Download & Install Portable Editor.
What Option 1 Does Automatically
- Downloads the latest official Windows x64
.ziparchive (Microsoft CDN for VS Code, GitHub Releases for VSCodium). - Extracts the archive into your target directory and creates the Portable Mode folders:
<InstallDir>\data\<InstallDir>\data\user-data\User\<InstallDir>\data\extensions\
- Registers 4 Windows Explorer right-click context menus (
Files,Folders,Folder Background,Drives) underHKCU\Software\Classes. - Adds
<InstallDir>\binto your UserPATHsocode/code-insiders/codium/codium-insiderswork from any terminal. - Checks software dependencies for any preconfigured extensions and installs missing portable tools (with User
PATH& officialHKCUregistry keys). - Writes your merged
settings.jsoninto<InstallDir>\data\user-data\User\settings.json. - Installs preconfigured extensions directly into
<InstallDir>\data\extensions.
Understanding Portable Mode
When a data\ folder exists alongside Code.exe or VSCodium.exe, the editor runs in official Portable Mode:
| Data Type | Location |
|---|---|
User Settings (settings.json) | <InstallDir>\data\user-data\User\settings.json |
| Keybindings & Snippets | <InstallDir>\data\user-data\User\ |
| Installed Extensions | <InstallDir>\data\extensions\ |
| Cache & Workspace State | <InstallDir>\data\user-data\ |
Nothing is written to %APPDATA%\Code or %USERPROFILE%\.vscode, making it easy to move, back up, or run multiple editions side by side.
Next Steps
- Configuration Guide (
config.ini&editor.ini) - Optional Profiles & Extension Packs
- CLI Reference
- Extension Dependencies & Portable Toolchains
Configuration (config.ini & editor.ini)
Configuration is intentionally split into manager configuration (config.ini) and editor configuration (editor.ini + optional profiles\*.ini files).
config.ini Reference
Leave any [General] option blank to be prompted interactively at runtime. Command-line flags override config.ini.
[General]
| Key | Valid Values | Description |
|---|---|---|
DefaultInstallDir | Path template (supports {program_name}) | Where portable editors are installed (e.g., D:\IDE\{program_name} expands to D:\IDE\VSCode, D:\IDE\VSCodium-Insiders). Leave blank to prompt. |
DefaultToolsDir | Path template (supports {tool_name}) | Where portable extension dependencies are installed (e.g., D:\CLI\{tool_name} expands to D:\CLI\Git, D:\CLI\Ripgrep, D:\CLI\Python). |
DefaultProduct | vscode | vscodium | blank | Default editor distribution. |
DefaultChannel | stable | insiders | blank | Default release channel. |
AutoAddContextMenu | true | false | blank | Automatically register Explorer right-click context menus on install. |
AutoAddPath | true | false | blank | Automatically add <InstallDir>\bin to User PATH on install. |
AutoConfigureSettings | true | false | blank | Automatically apply resolved INI settings to settings.json on install. |
OverwriteExistingSettings | false (default) | true | false performs a non-destructive merge (keeps existing user values and only adds missing keys). true updates conflicting keys from your INI files. Always saves settings.json.bak before editing an existing file. |
AutoInstallExtensions | true | false | blank | Automatically install extensions loaded from [Extensions] in configured profiles / editor.ini. |
AutoInstallDependencies | true | false | blank | Automatically install missing portable software dependencies required by extensions (with PATH & official HKCU registry entries). |
[Profiles]
| Key | Valid Values | Description |
|---|---|---|
OptionalProfiles | Blank, single name, comma-separated names, or .ini path(s) | Optional profiles from profiles\ to load (in order). Leave blank to load zero optional profiles. Example: portable-essentials, privacy, no-ai, low-end, ext-general. |
EditorConfigFile | Relative/absolute .ini path or blank | Path to your personal editor config file (default: editor.ini). Leave blank to skip. |
[Logging]
| Key | Valid Values | Description |
|---|---|---|
LogRetentionDays | Positive integer (default: 30) | Days to keep daily log files in logs\ before automatic pruning. |
LogFilePrefix | String or blank | Custom filename prefix for logs\<prefix>-YYYY-MM-DD.log. Leave blank to automatically use the project folder name (vscode-portable-manager-YYYY-MM-DD.log). |
editor.ini Reference
Your personal editor configuration file (opened via main.bat Option 9) is loaded only when EditorConfigFile is set in config.ini.
[Profile]
Name = Personal Editor Configuration
Description = My custom portable VS Code / VSCodium defaults.
[Settings]
update.mode = none
update.showReleaseNotes = false
editor.fontSize = 14
editor.fontFamily = "JetBrains Mono, Consolas, monospace"
files.autoSave = afterDelay
files.autoSaveDelay = 1000
files.watcherExclude = {"**/node_modules/**": true, "**/dist/**": true}
[Extensions]
editorconfig.editorconfig
ms-vscode.powershell
[Dependencies]
# Optional explicit tool IDs to check/install portably (e.g. git, ripgrep, python)
Supported Value Types Under [Settings]
| INI Syntax | Written to settings.json As |
|---|---|
true / false | JSON boolean (true / false) |
14, 1000, 1.5 | JSON number |
none, afterDelay | JSON string |
"14", "Consolas, monospace" | Quoted string (forces string type and preserves whitespace/quotes) |
\n, \r\n | Newline escape string (useful for files.eol = \n) |
{"*": false} or ["*.tmp"] | Parsed JSON object or array (deep-merged for nested objects!) |
Dynamic Path Tokens Under [Settings]
Any string value under [Settings] supports automatic path tokens expanded at write time:
| Token | Expands To |
|---|---|
{install_dir} | Absolute portable editor install directory (e.g., D:\IDE\VSCode) |
{data_dir} | <InstallDir>\data |
{ripgrep_path} | Verified rg.exe path (prefers standalone portable/PATH rg.exe, falls back to editor-bundled rg.exe) |
Layering & Precedence Order
When multiple INI files are active, settings are merged in strict deterministic order (later layers override earlier ones):
- Existing
data\user-data\User\settings.json(preserved unlessOverwriteExistingSettings = trueor-Overwrite) OptionalProfilesin the exact order listed inconfig.ini(or-Preset)EditorConfigFile(editor.ini) — always overrides optional profiles- Auto-wired portable dependency paths (
todo-tree.ripgrep.ripgrep,git.path,clangd.path,cmake.cmakePath,shellcheck.executablePath,python.defaultInterpreterPath) - Interactive wizard edits (when using
configure.ps1Option 3)
Optional Profiles & Extension Packs (profiles\*.ini)
All optional profiles live as clean, active (uncommented) .ini files inside profiles\. They are never loaded unless you explicitly enable them in config.ini (OptionalProfiles), pass -Preset on the CLI, or pick them interactively in configure.ps1.
Built-In Settings Profiles
| Profile Name | File | Summary |
|---|---|---|
portable-essentials | profiles/portable-essentials.ini | Minimal portable defaults: sets update.mode = "none" and update.showReleaseNotes = false so updates remain cleanly managed by update.ps1. |
privacy | profiles/privacy.ini | Portable essentials + disables telemetry, feedback prompts, experiments, and Bing-backed natural language settings search. |
no-ai | profiles/no-ai.ini | Disables built-in AI features (chat.disableAIFeatures = true), chat command center, agent mode, inline ghost-text suggestions, and GitHub Copilot (github.copilot.enable = {"*": false}, auto-completions, next-edit suggestions). |
low-end | profiles/low-end.ini | Performance tuning for low-end / older hardware: disables minimap, smooth scrolling, caret animations, sticky scroll, CodeLens, inlay hints, semantic highlighting, bracket colorization, terminal GPU acceleration, auto-fetch/refresh, and adds heavy folder exclusions to files.watcherExclude. |
recommended | profiles/recommended.ini | Balanced portable developer setup: portable essentials + privacy off + sensible editor, autosave, whitespace, terminal, and Git defaults. |
Built-In Extension Pack Profiles
| Profile Name | File | Included Extensions | Required Portable Dependencies |
|---|---|---|---|
ext-general | profiles/ext-general.ini | EditorConfig, GitLens, Git Graph, Markdown All in One, Error Lens, Todo Tree (+ sets todo-tree.ripgrep.ripgrep = {ripgrep_path}) | git, ripgrep |
ext-web | profiles/ext-web.ini | ESLint, Prettier, Tailwind CSS, Auto Rename Tag, Path Intellisense, Live Server | node |
ext-python | profiles/ext-python.ini | Python, Ruff, Jupyter, Even Better TOML | python |
ext-cpp | profiles/ext-cpp.ini | clangd, CMake, CMake Tools, CodeLLDB | clangd, cmake, ninja |
ext-rust | profiles/ext-rust.ini | rust-analyzer, Even Better TOML, CodeLLDB | rust |
ext-devops | profiles/ext-devops.ini | Docker, YAML, Terraform, PowerShell, ShellCheck | docker (manual), terraform, pwsh, shellcheck |
Combining Multiple Profiles
List multiple profiles separated by commas in config.ini:
[Profiles]
OptionalProfiles = portable-essentials, privacy, no-ai, low-end, ext-general, ext-python
EditorConfigFile = editor.ini
- Later profiles override earlier profiles if both define the same
[Settings]key. - Nested objects (such as
files.watcherExclude) are deep-merged. - Extension lists across multiple
ext-*profiles are automatically deduplicated (for example,tamasfe.even-better-tomlin bothext-pythonandext-rustis installed once). editor.inialways has the final word over every optional profile.
Creating Your Own Drop-In Profile
Drop any .ini file into profiles\ (for example, profiles\my-work.ini):
[Profile]
Name = My Work Setup
Description = Company formatting rules and Go toolchain.
[Settings]
editor.tabSize = 2
editor.formatOnSave = true
[Extensions]
golang.go
editorconfig.editorconfig
[Dependencies]
go
git
It is automatically discovered by configure.ps1 and can be referenced immediately via OptionalProfiles = my-work or -Preset my-work without modifying any scripts.
CLI Reference
All four scripts under src\ require PowerShell 7.x (pwsh.exe) and can be called directly for scripting or automation.
src\install.ps1 — Fresh Portable Install
Downloads, extracts, enables Portable Mode, integrates Explorer/PATH, installs missing portable dependencies, writes settings.json, and installs extensions.
pwsh -NoProfile -ExecutionPolicy Bypass -File src\install.ps1 [options]
| Parameter | Type | Description |
|---|---|---|
-ScriptRoot | string | Override project root directory (auto-detected if omitted). |
-TargetDir | string | Explicit installation path (overrides DefaultInstallDir). |
-Product | vscode | vscodium | Override DefaultProduct. |
-Channel | stable | insiders | Override DefaultChannel. |
-Preset | string | Comma-separated optional profile name(s) or .ini path(s) (overrides OptionalProfiles). |
-SkipContextMenu | switch | Do not register Explorer context menus. |
-SkipPath | switch | Do not add bin\ to User PATH. |
-SkipSettings | switch | Do not modify settings.json. |
-SkipExtensions | switch | Do not install preconfigured extensions. |
-SkipDependencies | switch | Check dependencies without installing missing portable tools. |
-InstallDependencies | switch | Auto-install missing portable dependencies without prompting. |
-OverwriteSettings | switch | Overwrite conflicting existing keys in settings.json. |
-Force | switch | Skip confirmation if target directory already contains an editor. |
src\update.ps1 — In-Place Binary Update
Updates editor binaries in-place while preserving the entire portable data\ folder (settings, extensions, workspace state).
pwsh -NoProfile -ExecutionPolicy Bypass -File src\update.ps1 [options]
| Parameter | Type | Description |
|---|---|---|
-ScriptRoot | string | Override project root directory. |
-TargetDir | string | Target portable folder (auto-discovers if omitted). |
-Force | switch | Skip update confirmation and up-to-date tag check prompts. |
src\configure.ps1 — Standalone Configurator
Interactive dashboard and non-interactive CLI for managing existing portable installations.
pwsh -NoProfile -ExecutionPolicy Bypass -File src\configure.ps1 [options]
| Parameter | Type | Description |
|---|---|---|
-ScriptRoot | string | Override project root directory. |
-TargetDir | string | Target portable folder (auto-discovers if omitted). |
-Mode | string | Interactive (default), Status, Settings, AddContextMenu, RemoveContextMenu, AddPath, RemovePath, InstallExtensions, CheckDependencies, ExportProfile, ImportProfile. |
-Preset | string | Optional profile name(s) or .ini path(s) for Settings, InstallExtensions, or CheckDependencies. |
-ProfilePath | string | JSON bundle path for ExportProfile / ImportProfile. |
-Overwrite | switch | Overwrite conflicting keys in settings.json. |
-SkipDependencies | switch | Skip installing missing portable dependencies. |
-InstallDependencies | switch | Auto-install missing portable dependencies without prompting. |
Examples
# Inspect installation health (version, portable data, context menus, PATH, settings, extensions)
pwsh -File src\configure.ps1 -TargetDir "D:\IDE\VSCode" -Mode Status
# Apply low-end + no-ai profiles non-interactively
pwsh -File src\configure.ps1 -TargetDir "D:\IDE\VSCode" -Mode Settings -Preset "low-end,no-ai" -Overwrite
# Check and install missing portable dependencies for installed + configured extensions
pwsh -File src\configure.ps1 -TargetDir "D:\IDE\VSCode" -Mode CheckDependencies -InstallDependencies
# Export settings.json + installed extensions list to a portable JSON backup
pwsh -File src\configure.ps1 -TargetDir "D:\IDE\VSCode" -Mode ExportProfile -ProfilePath ".\my-backup.json"
# Restore backup onto a fresh portable installation
pwsh -File src\configure.ps1 -TargetDir "D:\IDE\VSCodium" -Mode ImportProfile -ProfilePath ".\my-backup.json"
src\uninstall.ps1 — Removal & Cleanup
Auto-discovers portable installations (including stale registry/PATH leftovers of manually deleted folders) for clean removal.
pwsh -NoProfile -ExecutionPolicy Bypass -File src\uninstall.ps1 [options]
| Parameter | Type | Description |
|---|---|---|
-ScriptRoot | string | Override project root directory. |
-TargetDir | string | Explicit folder to clean up/uninstall. |
-RegistryOnly | switch | Remove context menus, MuiCache entries, and User PATH entries while keeping all files on disk. |
-Force | switch | Skip per-target confirmation prompts. |
Extension Dependencies & Portable Toolchains
Many VS Code and VSCodium extensions depend on external CLI binaries or language toolchains. To keep your entire setup 100% portable, the manager automatically checks required software before installing extensions (or on demand via configure.ps1 -Mode CheckDependencies / Option 11).
How Detection Works
For each required tool, Test-DependencyInstalled checks in order:
- System & User
PATH(automatically ignores Microsoft Store’s 0-byteWindowsApps\python.exestub alias). - Windows
App Pathsregistry (HKCUandHKLM). - Official program registry keys (
HKCU/HKLM, including PEP 514Software\Python\PythonCore). - Your configured
DefaultToolsDir(e.g.,D:\CLI\{tool_name}). If a portable copy already exists there withoutPATH/registry registration, the manager automatically repairs itsPATHand officialHKCUregistry keys.
Supported Portable Toolchains
Every portable tool is downloaded directly from its official upstream Windows x64 release, extracted into DefaultToolsDir (e.g., D:\CLI\<ToolName>), added to User PATH (and the active process PATH with WM_SETTINGCHANGE broadcast), and registered under its official per-program HKCU registry keys:
| Tool ID | Triggered By Extensions | Official Portable Source | Official HKCU Registry Keys Written | Auto-Wired settings.json Key |
|---|---|---|---|---|
git | gitlens, git-graph, githistory, gitblame, vscode-pull-request-github | git-for-windows/git (MinGit-*-64-bit.zip) | Software\GitForWindows + App Paths\git.exe | git.path |
ripgrep | gruntfuggly.todo-tree | BurntSushi/ripgrep (x86_64-pc-windows-msvc.zip) | Software\ripgrep + App Paths\rg.exe | todo-tree.ripgrep.ripgrep |
node | vscode-eslint, prettier-vscode, vscode-tailwindcss, vitest.explorer, playwright | Official nodejs.org latest LTS win-x64.zip | Software\Node.js + App Paths\node.exe | (via PATH) |
python | ms-python.python, vscode-pylance, debugpy, jupyter | Official NuGet python .nupkg (tools\) + ensurepip | Software\Python\PythonCore\<X.Y> (PEP 514) + App Paths\python.exe | python.defaultInterpreterPath |
cmake | twxs.cmake, ms-vscode.cmake-tools, ms-vscode.cpptools | Kitware/CMake (windows-x86_64.zip) | Software\Kitware\CMake + App Paths\cmake.exe | cmake.cmakePath |
ninja | ms-vscode.cmake-tools, ms-vscode.cpptools | ninja-build/ninja (ninja-win.zip) | Software\Ninja + App Paths\ninja.exe | (via PATH) |
clangd | llvm-vs-code-extensions.vscode-clangd | clangd/clangd (clangd-windows-*.zip) | Software\LLVM\clangd + App Paths\clangd.exe | clangd.path |
rust | rust-lang.rust-analyzer | Official rustup-init.exe with portable CARGO_HOME & RUSTUP_HOME | Software\Rust + App Paths\rustc.exe, cargo.exe | (via PATH + env vars) |
go | golang.go | Official go.dev/dl stable windows-amd64.zip + GOROOT | Software\GoProgrammingLanguage + App Paths\go.exe | (via PATH + GOROOT) |
terraform | hashicorp.terraform | HashiCorp Checkpoint + windows_amd64.zip | Software\HashiCorp\Terraform + App Paths\terraform.exe | (via PATH) |
shellcheck | timonwong.shellcheck | koalaman/shellcheck (shellcheck-v*.zip) | Software\ShellCheck + App Paths\shellcheck.exe | shellcheck.executablePath |
pwsh | ms-vscode.powershell | PowerShell/PowerShell (win-x64.zip) | Software\PowerShell + App Paths\pwsh.exe | (via PATH) |
gh | github.vscode-pull-request-github | cli/cli (gh_*_windows_amd64.zip) | Software\GitHub\CLI + App Paths\gh.exe | (via PATH) |
docker | ms-azuretools.vscode-docker | (Non-portable: requires Windows service / WSL2 daemon) | Detected & reported with manual install instructions | — |
Controlling Automatic Dependency Installs
In config.ini:
[General]
DefaultToolsDir = D:\CLI\{tool_name}
AutoInstallDependencies = true # true | false | blank (prompt Y/S/N)
You can also declare explicit tool requirements in any profile or editor.ini via [Dependencies]:
[Dependencies]
git
ripgrep
python
Troubleshooting
PowerShell 7 (pwsh.exe) Not Found
Symptom: main.bat reports [ERROR] PowerShell 7 (pwsh.exe) was not found in PATH, or running a .ps1 script directly fails with a version error.
Cause: All entrypoints include #Requires -Version 7.0 and do not support legacy Windows PowerShell 5.1 (powershell.exe).
Fix:
winget install Microsoft.PowerShell
Close and reopen your terminal so pwsh.exe is in PATH.
Todo Tree: Failed to find vscode-ripgrep
Symptom: Todo Tree displays:
Todo-Tree: Failed to find vscode-ripgrep - please install ripgrep manually and set 'todo-tree.ripgrep' to point to the executable
Cause:
- Newer VS Code builds moved bundled ripgrep to
@vscode/ripgrep-universal, breaking Todo Tree’s built-in lookup. - Todo Tree’s error message is outdated:
"todo-tree.ripgrep"is a parent namespace object in its schema, so VS Code ignores a string value there. The actual setting key is"todo-tree.ripgrep.ripgrep".
Fix: Run the dependency check against your portable install:
pwsh -File src\configure.ps1 -Mode CheckDependencies -InstallDependencies
This installs portable ripgrep (rg.exe), adds it to PATH and HKCU\Software\ripgrep, removes any invalid "todo-tree.ripgrep" string key, writes "todo-tree.ripgrep.ripgrep", and takes effect after reloading the VS Code window (Ctrl+Shift+P → Developer: Reload Window).
Newly Added PATH Entries Aren’t Seen in Already-Open Terminals
Cause: Windows processes inherit PATH when launched. Although the manager broadcasts WM_SETTINGCHANGE, already-running terminals and some Explorer-launched processes do not reload PATH until restarted.
Fix:
- Open a new terminal window (new shells pick up the updated User
PATH). - For editor extensions (
git,ripgrep,clangd,cmake,shellcheck,python), the manager also writes explicit executable paths intodata\user-data\User\settings.jsonso they work immediately without restarting Explorer.
uninstall.ps1 or update.ps1 Reports Locked Files
Cause: An editor window, background extension host, or open terminal is still holding handles inside the installation folder.
Fix: Both update.ps1 and uninstall.ps1 automatically terminate running editor processes strictly inside <InstallDir>\. If external processes (such as a shell whose current directory is inside <InstallDir>) hold a lock, close those shells and re-run the command.
GitHub API Rate Limit (HTTP 403)
Symptom: Installing VSCodium or a GitHub-hosted portable dependency fails with 403 rate limit exceeded.
Cause: Unauthenticated GitHub API requests are limited to 60 requests/hour per IP address.
Fix: Wait for the rate-limit window to reset, or retry later.
Inspecting Verbose Daily Logs
Every action appends complete diagnostics (SESSION START, loaded INI files, HTTP redirects/sizes, registry keys written/deleted, settings merges, stack traces, and SESSION END) to:
logs\<prefix>-YYYY-MM-DD.log
Open the logs folder directly from main.bat (Option 7 — Open Logs Folder). Remember to redact personal usernames/paths before sharing logs publicly.
Architecture Overview
Portable VS Code & VSCodium Manager uses a strict 4-layer PowerShell 7.x architecture designed for zero external module dependencies, high performance via direct .NET APIs, and complete portability without Administrator elevation.
Directory & Layer Map
{ROOT}\
├── main.bat Interactive launcher (invokes pwsh.exe)
├── config.ini Manager settings & INI profile pointers
├── editor.ini Personal editor [Settings] & [Extensions]
├── README.txt Standalone runtime doc (packaged in release ZIPs)
├── profiles\ Opt-in active INI profiles (discovered dynamically)
│ ├── *.ini Settings profiles (low-end, no-ai, privacy, etc.)
│ └── ext-*.ini Extension packs (ext-general, ext-python, etc.)
├── logs\ Auto-created daily verbose logs (30-day retention)
└── src\
├── install.ps1 [Layer 4] CLI entrypoint: fresh install
├── update.ps1 [Layer 4] CLI entrypoint: in-place binary update
├── configure.ps1 [Layer 4] CLI entrypoint: standalone configurator
├── uninstall.ps1 [Layer 4] CLI entrypoint: removal & cleanup
├── core\ [Layer 3] Domain logic & orchestration
│ ├── config.ps1 INI parser, profile/editor loader & defaults
│ ├── edition.ps1 Product/channel metadata, version & ripgrep lookup
│ ├── discovery.ps1 Multi-source portable install auto-discovery
│ ├── settings.ps1 settings.json schema, JSONC parser & deep merger
│ └── dependencies.ps1 Extension dependency detection & portable installers
├── utility\ [Layer 2] Low-level OS & I/O primitives
│ ├── filesystem.ps1 HttpClient download, ZipFile extract, fast delete
│ ├── path.ps1 User PATH manager + WM_SETTINGCHANGE broadcast
│ └── registry.ps1 .NET Microsoft.Win32.Registry manager
└── event\ [Layer 1] Cross-cutting telemetry & UI
├── logger.ps1 Verbose daily file logger & retention pruner
└── progress.ps1 Throttled inline wget-style progress bar
Dependency Flow
flowchart TD
BAT["main.bat"] --> EP["Entrypoints: install / update / configure / uninstall"]
EP --> CORE["src/core: config, edition, discovery, settings, dependencies"]
CORE --> UTIL["src/utility: filesystem, path, registry"]
CORE --> EVT["src/event: logger, progress"]
UTIL --> EVT
EVT --> PROG["progress.ps1"]
- Strict Acyclic Layering: Entrypoints dot-source all layers cleanly; library modules guard dot-sourcing via
Get-Commandchecks so re-sourcing is idempotent and never resets$script:state. - Root Resolution Depth: Because
src\core\config.ps1andsrc\event\logger.ps1reside two levels below{ROOT}, fallback$ScriptRootcomputation always traverses two parent directories (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent).
Key Architectural Decisions
1. Pure .NET [Microsoft.Win32.Registry] Instead of PowerShell Registry Cmdlets
PowerShell’s HKCU:\ Registry provider interprets * as a wildcard in -Path (and New-Item lacks -LiteralPath), causing New-Item -Path "HKCU:\Software\Classes\*\shell\VSCode" to expand across thousands of file-extension subkeys or stall. Using [Microsoft.Win32.Registry]::CurrentUser (CreateSubKey, OpenSubKey, SetValue, DeleteSubKeyTree, DeleteValue) directly completely eliminates wildcard hazards and scans targeted shell keys in milliseconds.
2. Strictly Opt-In INI Profiles (profiles\*.ini) + Personal editor.ini
Rather than hardcoding preset dictionaries in PowerShell or shipping huge commented-out blocks in config.ini, every optional profile is a standalone, active .ini file in profiles\. Get-ManagerConfig loads only the profile INIs listed in OptionalProfiles and the file referenced by EditorConfigFile. Dropping a new .ini file into profiles\ immediately makes it discoverable without code edits.
3. Install Step Ordering (Dependencies → Settings → Extensions)
src\install.ps1 resolves configured profiles, installs required portable toolchains (ripgrep, git, python, etc.) before writing settings.json, and merges all resolved settings + auto-wired executable paths in a single clean write. This guarantees {ripgrep_path} and extension path keys (todo-tree.ripgrep.ripgrep, git.path, etc.) point to real portable binaries on the very first write with zero spurious warnings or redundant .bak files.
4. Exact Directory-Boundary Safety
All path-scoped operations prevent prefix collisions (such as D:\IDE\VSCode accidentally matching D:\IDE\VSCode-Insiders):
Remove-UserPathEntrycompares exact$TargetDiror$TargetDir\*.Stop-EditorProcessesInDirchecks$_.Path.StartsWith("$Dir\", OrdinalIgnoreCase).Test-RegistryValueMatchesDirmatches directory boundaries via regex(?:^|["'\s])<Dir>(?:\\|["'\s]|$).Expand-ZipWithProgressenforces Zip Slip guards with trailing directory separator checks.
5. Official Per-Program Registry Keys & Non-Admin Portability
Portable tools installed by dependencies.ps1 never require Admin elevation and always register under their official HKCU vendor/program keys (e.g., HKCU\Software\GitForWindows, HKCU\Software\Python\PythonCore\<X.Y> per PEP 514, HKCU\Software\Node.js, HKCU\Software\Kitware\CMake, HKCU\Software\ripgrep) plus HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\<exe>.
Module & Function API Reference
Function-level reference for all library modules under src\event\, src\utility\, and src\core\.
src\event\progress.ps1
| Function | Description |
|---|---|
Test-ConsoleInteractive | Safely detects whether stdout is an interactive console (prevents exceptions when output is redirected/piped). |
Clear-ProgressLine | Erases any active inline progress bar before printing a console log line. |
Show-WgetProgress -Task -Percent [-Stats] [-ThrottleMs 75] [-Complete] | Renders a throttled wget/docker-style inline progress bar with elapsed mm:ss timer. |
src\event\logger.ps1
| Function | Description |
|---|---|
Resolve-ProjectRoot [-ScriptRoot] | Resolves {ROOT} from argument or two parent levels above src\event\. |
Invoke-LogPruning -LogsDir [-RetentionDays 30] | Deletes *.log files older than RetentionDays; returns List[string] of pruned filenames (via unary ,). |
Initialize-Logger [-ScriptRoot] [-Component] [-RetentionDays] [-LogPrefix] [-Context] | Creates logs\, prunes expired logs, opens logs\<prefix>-YYYY-MM-DD.log, and writes a full SESSION START banner. |
Get-CurrentLogFilePath | Returns the active daily log file path. |
Write-Log -Message [-Level] | Writes timestamped [file:line] entry to the log file; prints INFO/WARN/ERROR/SUCCESS to console (DEBUG/TRACE are file-only). |
Write-ExceptionLog -ErrorRecord [-Context] | Logs exception message (ERROR) plus exception type, inner exception, invocation position, and ScriptStackTrace (DEBUG). |
Close-Logger [-Status] | Writes SESSION END footer with elapsed duration. |
src\utility\filesystem.ps1
| Function | Description |
|---|---|
Invoke-FileDownloadWithProgress -Uri -OutFile [-TaskLabel] [-TimeoutMinutes 15] | Streams HTTPS downloads via System.Net.Http.HttpClient into a .part temp file, atomically moves to $OutFile, and logs resolved URI, HTTP status, size, speed, and duration. |
Expand-ZipWithProgress -ZipPath -DestinationPath [-PreserveData] [-StripSingleTopDir] [-OnlyUnderPrefix] [-TaskLabel] | Extracts .zip / .nupkg archives via System.IO.Compression.ZipFile with strict Zip Slip protection, optional data\ preservation, single-root flattening, and prefix extraction. |
Remove-FolderWithProgress -FolderPath [-TaskLabel] | High-speed .NET [System.IO.Directory]::EnumerateFiles / [System.IO.File]::Delete deletion with read-only attribute clearing and rd /s /q fallback. |
Stop-EditorProcessesInDir -InstallDir [-ProcessNames] | Stops running editor processes strictly inside $InstallDir\. |
src\utility\path.ps1
| Function | Description |
|---|---|
Send-EnvironmentChangeBroadcast | Broadcasts WM_SETTINGCHANGE ("Environment") via user32.dll SendMessageTimeout. |
Test-UserPathDirectory -Directory | Case-insensitive, trailing-slash-normalized check for any directory in User PATH. |
Add-UserPathDirectory -Directory [-AlsoUpdateProcessPath] | Deduplicated User PATH append + optional live $env:Path prepend + broadcast. |
Test-UserPathEntry -TargetDir | Checks <TargetDir>\bin in User PATH. |
Add-UserPathEntry -TargetDir | Adds <TargetDir>\bin to User PATH and current process PATH. |
Remove-UserPathEntry -TargetDir | Removes exact $TargetDir or $TargetDir\* entries from User PATH. |
src\utility\registry.ps1
| Function | Description |
|---|---|
Test-RegistryValueMatchesDir -Value -InstallDir | Directory-boundary-safe regex check preventing sibling path collisions. |
Add-ContextMenu -InstallDir [-Profile] | Registers 4 Explorer shell context menus (*, Directory, Directory\Background, Drive) under HKCU\Software\Classes via .NET Registry API. |
Test-ContextMenu -InstallDir [-Profile] | Returns registration count (RegisteredCount/TotalCount, IsComplete, Details). |
Find-EditorPathsInRegistry | Targeted non-recursive .NET scan across HKCU/HKLM shell keys, Applications, and App Paths. |
Remove-ContextMenuAndReg -InstallDir | Deletes matched shell keys and MuiCache entries referencing $InstallDir. |
Add-ToolAppPathRegistry -ExePath [-ExtraPathDirs] | Writes HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\<exe>. |
Add-PythonPep514Registry -PythonDir -Version | Writes PEP 514 HKCU\Software\Python\PythonCore\<X.Y> and InstallPath keys. |
Set-ProgramSoftwareRegistryKey -SubKey -Values | Writes values directly under HKCU\Software\<OfficialProgramName>. |
Get-ProgramSoftwareRegistryValue -SubKey [-ValueName] | Reads a program registry value from HKCU or HKLM. |
Find-ToolInAppPathsRegistry -ExeName | Resolves an executable from HKCU/HKLM App Paths. |
src\core\config.ps1
| Function | Description |
|---|---|
ConvertFrom-IniTypedValue -RawValue | Parses INI values into PowerShell booleans, longs, doubles, strings, newline escapes, or JSON objects/arrays (ConvertFrom-Json -AsHashtable). |
Resolve-ConfigBool -Value | Converts true/1/yes/on → $true, false/0/no/off → $false, blank → $null. |
Resolve-IniFilePath -NameOrPath -ScriptRoot [-SearchProfilesDir] | Resolves profile names or relative/absolute .ini paths. |
Import-EditorIniFile -Path | Parses [Profile], [Settings], [Extensions], and [Dependencies] from any profile or editor .ini. |
Get-ManagerConfig [-ScriptRoot] | Parses config.ini and loads only referenced OptionalProfiles and EditorConfigFile. |
Write-ConfigDiagnosticLog -Config | Logs full loaded config, profiles, and counts at DEBUG level. |
Get-TargetDir -ProvidedPath -Config [-Profile] [-PromptText] | Expands {program_name} and resolves target installation directory. |
src\core\edition.ps1
| Function | Description |
|---|---|
Get-EditorProfile -Product -Channel | Returns metadata hashtable for vscode/vscodium × stable/insiders. |
Get-AllEditorProfiles | Returns all 4 edition profiles. |
Select-EditorProfile [-Config] [-CliProduct] [-CliChannel] | Resolves or interactively prompts for product & channel. |
Resolve-PackageDownloadInfo -Profile | Returns { Url; Tag; AssetName } from Microsoft direct endpoint or GitHub Releases API. |
Get-InstalledEditorProfile -InstallDir | Detects installed edition from executable filename. |
Get-InstalledEditorVersion -InstallDir | Reads version from package.json, product.json, commit-hash-nested package.json, or PE FileVersionInfo. |
Test-PortableMode -InstallDir | Returns $true if <InstallDir>\data exists. |
Get-EditorCliPath -InstallDir [-Profile] | Locates <InstallDir>\bin\<cli>.cmd. |
Find-BundledRipgrepPath -InstallDir | Prefers standalone rg.exe (PATH, App Paths, HKCU\Software\ripgrep), falling back to @vscode\ripgrep-universal, legacy @vscode\ripgrep, and commit-hash layouts. |
src\core\discovery.ps1
| Function | Description |
|---|---|
Find-VSCodeInstalls [-Config] [-IncludeMissing] | Auto-discovers portable installations across .NET Registry, User PATH, running processes, and expanded DefaultInstallDir, excluding standard non-portable system/user installers. |
Format-InstallBadges -Install | Formats version, portable, context menu, and PATH status badges. |
Select-DiscoveredInstall -Discovered [-PromptTitle] [-AllowManualEntry] | Interactive installation picker shared by update.ps1, configure.ps1, and uninstall.ps1. |
src\core\settings.ps1
| Function | Description |
|---|---|
Get-SettingsSchema | Returns the curated interactive wizard schema across all categories (Portable & Updates, Privacy & Telemetry, AI & Copilot, Performance (Low-End), Editor, Files, Workbench & UI, Terminal, Git). |
Get-SettingsPresets [-ScriptRoot] | Dynamically loads every profiles\*.ini file via Import-EditorIniFile. |
ConvertFrom-Jsonc -RawText | String-literal-safe JSONC comment (//, /* */) and trailing-comma stripper + ConvertFrom-Json -AsHashtable. |
Read-EditorSettings -InstallDir / Write-EditorSettings -InstallDir -Settings | Reads/writes UTF-8 (no BOM) deterministically sorted data\user-data\User\settings.json with automatic .bak backup. |
Merge-SettingsHashtable -Base -Overlay [-OverwriteExisting] | Recursive deep merger tracking Added, Updated, and Preserved counts. |
Resolve-ConfiguredSettings [-Config] [-PresetName] [-ExtraOverrides] [-ScriptRoot] | Layers optional profile INI(s) → EditorConfigFile → inline fallback → runtime overrides; returns { Settings; Extensions; Dependencies; Sources }. |
Expand-SettingsTokens -Settings -InstallDir | Expands {ripgrep_path}, {install_dir}, and {data_dir} in string values. |
Apply-EditorSettings -InstallDir -OverlaySettings [-OverwriteExisting] | Expands tokens, merges into existing settings.json, and writes to disk. |
Select-OptionalPresetInteractive [-ScriptRoot] / Invoke-InteractiveSettingsWizard -InstallDir | Interactive menus used by configure.ps1 and install.ps1. |
src\core\dependencies.ps1
| Function | Description |
|---|---|
Get-DependencyCatalog | Definitions for all supported tools (Git, ripgrep, Node.js, Python 3, CMake, Ninja, clangd, Rust, Go, Terraform, ShellCheck, PowerShell 7, Docker). |
Get-ExtensionDependencyMap | Maps VS Code / VSCodium extension IDs to required tool IDs. |
Get-RequiredDependenciesForExtensions [-Extensions] [-ExtraDependencies] | Deduplicates required tool IDs with their requesting extension reasons. |
Test-DependencyInstalled -ToolId [-Config] | Multi-source check (PATH skipping WindowsApps Python stubs, App Paths, official Software\* / PEP 514 registry, DefaultToolsDir). |
Resolve-ToolDownloadInfo -Tool | Queries official GitHub Releases, nodejs.org, NuGet v3, HashiCorp Checkpoint, go.dev, or rustup-init. |
Register-PortableToolEnvironmentAndRegistry -Tool -InstallDir [-Version] | Registers User + process PATH, App Paths\<exe>, and official HKCU\Software\<Program> keys. |
Install-PortableDependency -ToolId [-Config] | Downloads, extracts, bootstraps (ensurepip for Python / portable rustup-init for Rust), and registers a portable tool. |
Get-DependencyExecutableSettingsPatch -RequiredMap [-Config] | Builds the settings.json executable path patch (todo-tree.ripgrep.ripgrep, git.path, etc.). |
Invoke-DependencyCheckAndInstall | Full dependency audit, interactive/automatic portable installation, existing portable tool registration repair, legacy key cleanup, and settings.json wiring. |
Extending the Manager
Step-by-step guides for adding new profiles, portable dependencies, editor editions, or settings schema entries.
1. Adding a New Optional Profile (profiles\*.ini)
No PowerShell changes are required. Create a new .ini file inside profiles\:
[Profile]
Name = Extensions: Go Development
Description = Official Go extension and portable Go toolchain.
[Settings]
go.toolsManagement.autoUpdate = true
[Extensions]
golang.go
[Dependencies]
go
Because Get-SettingsPresets scans profiles\*.ini dynamically:
- It immediately appears in
configure.ps1Option 2. - It can be referenced via
OptionalProfiles = ext-goinconfig.inior-Preset ext-goon the CLI. - Update the profile list comments in
config.ini,README.txt, anddocs/user/profiles.mdif contributing it as a built-in profile.
2. Adding a New Portable Software Dependency
Edit src/core/dependencies.ps1:
- Add the tool specification to
Get-DependencyCatalog:- Use an official upstream Windows x64 portable archive (GitHub Release
.zipor official JSON API). - Set
StripSingleTopDir = $trueif the archive wraps all files inside a versioned top-level directory. - Set
SoftwareRegKeyto the tool’s official Windows registry key underSoftware\<VendorOrProgram>(never invent a manager-specific namespace).
- Use an official upstream Windows x64 portable archive (GitHub Release
- Map extension IDs in
Get-ExtensionDependencyMap:"publisher.extension-id" = @("my-tool") - Add resolver logic in
Resolve-ToolDownloadInfo(if not using standard"GitHubZip"). - Add official registry writes in
Register-PortableToolEnvironmentAndRegistryunderswitch ($Tool.Id):"my-tool" { $null = Set-ProgramSoftwareRegistryKey -SubKey "Software\Vendor\MyTool" -Values @{ InstallDir = $CleanDir Version = $Version } } - (Optional) Auto-wire the executable path into
settings.json:- If the extension has an explicit binary-path setting (verify its exact
package.jsonkey!), add it to$ToolSettingKeyMapin bothGet-DependencyExecutableSettingsPatchandInvoke-DependencyCheckAndInstall.
- If the extension has an explicit binary-path setting (verify its exact
- Document it in
README.txtanddocs/user/dependencies.md.
3. Adding a New Setting to the Interactive Wizard
Edit Get-SettingsSchema in src/core/settings.ps1:
@{
Key = "editor.rulers"
Category = "Editor"
Type = "string"
Default = "[80, 120]"
ValidValues = @()
Description = "Vertical ruler column positions"
}
4. Adding a New Editor Edition
Edit src/core/edition.ps1:
- Add the edition metadata hashtable to
Get-EditorProfileandGet-AllEditorProfiles(Product,Channel,DisplayName,ProgramName,ExeName,CliCmd,ProcessName,RegistryKey,MenuLabel,SourceType, endpoint info). - Add executable detection in
Get-InstalledEditorProfile(place more specific names like*- Insiders.exebefore base names). - Update the executable regex in
Find-EditorPathsInRegistry(src\utility\registry.ps1) and process lists inFind-VSCodeInstalls(src\core\discovery.ps1) andStop-EditorProcessesInDir(src\utility\filesystem.ps1).
Release Packaging Guide
This repository separates GitHub repository / documentation files from standalone runtime release files so .github/workflows/release.yml produces a clean, minimal .zip archive for end users.
Automated Release Workflow
Releases are packaged and published automatically by .github/workflows/release.yml:
- Tag Push (
v*.*.*): Pushing a semantic version tag (e.g.,git tag v1.0.0 && git push origin v1.0.0) validates syntax, stages strictly the runtime allowlist, buildsvscode-portable-manager-<tag>.zip+.sha256, uploads workflow artifacts, and publishes a GitHub Release usingsecrets.PAT_TOKEN(withsecrets.GITHUB_TOKENfallback). Tags containing-(e.g.,v1.1.0-beta.1) are automatically marked as prereleases. - Manual Dry Run (
workflow_dispatch): Trigger from the GitHub Actions tab withdry_run: trueto build and download the.zip+.sha256artifacts without publishing a release.
Release Archive Contents (vscode-portable-manager-vX.Y.Z.zip)
Included in Release .zip (Strict Allowlist)
| Path | Purpose in Packaged Release |
|---|---|
README.txt | Standalone plain-text user guide (replaces README.md and docs\ inside the ZIP) |
main.bat | Interactive Windows launcher |
config.ini | Clean generic default manager configuration |
editor.ini | Clean starter personal editor configuration |
profiles\*.ini | All built-in optional settings and extension pack profiles |
src\** | All 4 CLI entrypoints + core\, event\, and utility\ modules |
Excluded from Release .zip (Enforced by Staging Audit)
The workflow actively fails the build if any of the following leak into the staged archive:
*.md(README.md,ROADMAP.md,CHANGELOG.md,SECURITY.md,PRIVACY.md,CONTRIBUTING.md,CODE_OF_CONDUCT.md)docs\**.github\**,.git\**,.gitignorelogs\**(auto-created on first run)plan.txt
Pre-Tag Checklist
- Ensure
config.inicontains generic defaults (D:\tools\{program_name},D:\tools\{tool_name}, blankOptionalProfiles,EditorConfigFile = editor.ini, blankLogFilePrefix). - Confirm
README.txtreflects any new CLI flags, profiles, or portable dependencies. - Move items in
CHANGELOG.mdfrom[Unreleased]into the new version heading. - Confirm CI (
CI Validation & Tests) is green onmain, then tag and push:git tag -a v1.0.0 -m "Release v1.0.0" git push origin v1.0.0