Reusable PowerShell configuration that bridges PowerShell 5.1 and PowerShell 7+ across Windows, macOS, and Linux.
- Features
- Installation
- Configuration
- Usage
- Folder Structure
- Troubleshooting
- Contributing
- Attribution(AI Assistance)
- License
-
Cross-Edition Compatibility
Works in legacy PowerShell 5.1 (Desktop) and modern PowerShell 7+ (Core). -
Smart Toolchain Shims
- Optional enforcement of
.cmd
shims forpnpm
andwasm-opt
- Hyphen-free alias
wasmOpt
- Optional enforcement of
-
UTF-8 Everywhere
- Console encoding + BOM/no-BOM toggle
- Auto-
chcp 65001
on Windows PowerShell - Sets
LANG=en_US.UTF-8
on macOS/Linux
-
Copilot Integration
- Emits
ESC]133;C BEL
at prompt start - Emits
ESC]133;D;<EXITCODE> BEL
on command exit - Auto-registers/unregisters the exit-event handler
- Emits
-
Enhanced Prompt
Displays current path and Git branch:PS C:\path\to\repo (main)>
-
Helper Functions & Aliases
- Explicit wrapper functions to let pnpm and wasm-opt ensure they work as they do in Powershell 5.1
- wasmOpt alias function for wasm-opt
-
** Optional built-in TinyGo pathing fix
- Add to your repo
git submodule add https://github.com/BlazesRus/PowershellSettings PowershellSettings
- Place the terminal script in your VS Code workspace or user profile(either of 2 options):
-
VS Code Workspace Settings (.code-workspace):
{ "terminal.integrated.profiles.windows": { "PowerShell 7": { "path": [ "${env:ProgramFiles}\\PowerShell\\7\\pwsh.exe", "${env:ProgramFiles(x86)}\\PowerShell\\7\\pwsh.exe", "pwsh.exe" ], "icon": "terminal-powershell", "args": [ "-NoLogo", "-NoExit", "-ExecutionPolicy", "Bypass", "-Command", "& \"${workspaceFolder:projectroot}/PowershellSettings/PowerShellTerminal.ps1\"" ], "overrideName": true } }, "terminal.integrated.defaultProfile.windows": "PowerShell 7", "terminal.integrated.automationProfile.windows": "PowerShell 7" }
-
Extending a User Profile with this profile ($PROFILE in PowerShell):
# In your $PROFILE (e.g. $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1)
& "$HOME\path\to\PowershellSettings\PowerShellTerminal.ps1"
- In your PowerShell script or profile, dot-source the module:
#Adjust the $profilePath to actual PowershellSettings path
$profilePath = Join-Path $PSScriptRoot 'PowershellSettings' 'PowerShellTerminal.ps1'
if (Test-Path $profilePath) {
. $profilePath
} else {
throw "Profile not found at $profilePath"
}
- Customize PowershellSettings/ProfileSettings.psd1.
-
Prepending a pathDirectory (or file) to path:
Prepend-PathEntry pathToPrepend
-
Manually Emit Copilot Done Marker: After a long-running task, type:
done
in console.
-
Null-Coalescing in PS 5.1:
$value = NullCheck { $possiblyNull } { Get-DefaultValue }
-
TinyGo build fix (if enabled): Automatically runs at startup.
Edit PowershellSettings/ProfileSettings.psd1 to control profile behavior
PowershellSettings/
├─ ProfileSettings.psd1 # User-tweakable settings
├─ PowerShellTerminal.ps1 # Core profile logic
└─ … # (Optional helpers, future scripts)
-
node.exe
not found Ensure your Node install folder is in the system/user PATH before launching PowerShell 7(Optionally reinstall Node.js as fix). -
EPERM on
pnpm.CMD
- Run PowerShell as Administrator
- enable corepack manually by either:
corepack prepare pnpm@latest --activate
or
corepack enable pnpm
-
Invalid ProfileSettings.psd1 Ensure it is a pure hashtable literal (@{ key = value; }) with no in-table assignments.
-
Copilot markers not detected Confirm your terminal emulator forwards ANSI OSC sequences (ESC]…BEL).
- Fork this repo and create a branch.
- Update
ProfileSettings.psd1
defaults or add features. - Submit a PR with clear descriptions.
This PowerShell profile was originally generated using GitHub Copilot and further enhanced with support from Microsoft Copilot to better handle PowerShell 5.1 syntax, improve clarity, toolchain detection, developer ergonomics, and streamline cross-platform tooling. Contributing
This profile was crafted for clarity and cross-edition reliability. If you have enhancements or platform-specific fixes, feel free to open a pull request or issue.
MIT No Attribution (MIT-0) – see LICENSE.