This repository contains my personal PowerShell profile script, designed to enhance the terminal experience on Windows with improved aesthetics, navigation shortcuts, and utility functions tailored to my workflow.
- Oh My Posh: Automatically checks for, installs (via
winget), and initializes Oh My Posh for a rich prompt experience. - Theme Switcher: Built-in
themecommand to browse and apply Oh My Posh themes from GitHub. - Nerd Fonts: Configures JetBrains Mono Nerd Font as the default font if running in a supported terminal.
- Windows Terminal Auto-Config: If running inside Windows Terminal, it attempts to update the
settings.jsonto use the installed Nerd Font automatically. You can also runSet-WTAppearance -Opacity 0.85 -UseAcrylic $trueto customize the look. - VS Code Auto-Config: If running inside VS Code, it attempts to update the
settings.jsonto use the installed Nerd Font automatically. - IntelliSense: Enables History-based Predictive IntelliSense with a ListView style (requires PowerShell 7+).
- Tab Completion: Sets
Tabkey toMenuCompletefor a navigable menu of options.
..: Go up one directory....: Go up two directories.mk <path>: Alias forNew-DirectoryAndEnter. Create a directory and immediately enter it (mkdir+cd).
ll: Alias forGet-ChildItemForce. List all files (forces display of hidden items).touch <path>: Alias forUpdate-FileTimestamp. Create a new file or update the timestamp of an existing one.ff <name>: Alias forFind-File. Find files recursively by name in the current directory.unzip <path> [destination]: Alias forExpand-ArchiveFile. Extract a zip file (defaults to current directory).
theme: Alias forSet-PoshTheme. Opens a menu to browse, download, and apply Oh My Posh themes from GitHub.slideshow: Alias forShow-PoshThemeSlideshow. Cycles through Oh My Posh themes (alphabetical by default). Use-Randomto shuffle, and-Seconds <int>to set duration. Controls:Left/Rightto navigate,Enterto select,Escto cancel.sudo [command]: Alias forInvoke-ElevatedCommand. Run a command as Administrator (or elevate current shell if no command provided).reboot: Alias forInvoke-RebootCountdown. Reboot the computer with a 5-second countdown (cancellable).treboot [time]: Alias forRegister-ScheduledReboot. Schedule a reboot at a specific time (defaults to 3AM).areboot: Alias forUnregister-ScheduledReboot. Cancel a scheduled reboot.lock(aliasl): Alias forInvoke-LockWorkstation. Lock the workstation and turn off monitors with a 5-second countdown (cancellable).Clear-PSHistory: Clears both in-memory and persistent PSReadLine history.- Winget Completion: Registers native argument completion for
winget. up: Alias forUpdate-WindowsPackages. Upgrades software viawinget, updates NVIDIA drivers (if GPU detected), updates User-scope PowerShell modules (with auto-fix for conflicts), runs Windows Updates (viaPSWindowsUpdate), and reloadsPATH.Install-Git: Checks for and installs Git viawingetif not present.Refresh-Path: Alias forUpdate-EnvironmentPath. Reloads thePATHenvironment variable from the registry (Machine + User).kill-port <port>: Alias forStop-PortProcess. Finds and stops the process listening on a specific TCP port.cleanup: Alias forStart-SystemCleanup. Empties Recycle Bin, cleans Temp folders, and launches Windows Disk Cleanup.
grep: Alias forSelect-String.open: Alias forInvoke-Item.which <name>: Alias forGet-CommandSource. Returns the source path of a command.base64 <string>: Alias forConvert-Base64. Encode a string to Base64 (use-Decodeswitch to decode).df: Alias forGet-VolumeInfo. View disk volume information.du [path]: Alias forGet-DirectorySize. Calculate directory size.free: Alias forGet-MemoryUsage. Display memory usage (Total/Free).uptime: Alias forGet-SystemUptime. Show system uptime.ip: Alias forGet-NetworkSummary. Display a detailed, colored summary of network interfaces, IPs, and DNS.head [file]: Alias forGet-ContentHead. Display first 10 lines (supports pipeline).tail [file]: Alias forGet-ContentTail. Display last 10 lines (supports pipeline).wc [file]: Alias forMeasure-Content. Count lines, words, and characters (supports pipeline).
gst:git status -sb(short format).gco [branch]: Checkout a branch. If no argument provided, opens a GUI list to select a branch.gcmsg <msg>:git commit -mgpush:git push. Automatically sets upstream origin if pushing a new branch.gpull:git pullglog: Pretty-printed git log with graph, relative dates, and colors.gaa:git add --allgcb <name>:git checkout -b(create and switch to branch)gcom [msg]: Stage all changes and commit. Ifmsgis provided, uses it. Otherwise, shows status and prompts.gd:git diffgbr:git branchgsta:git stash pushgstp:git stash pop
pro: Edit the profile script (launches VS Code if available, falls back to Notepad).reload: Reload the profile script. Usereload -ClearCacheto force a deep clean of caches (Oh My Posh, fonts, etc.).pull-profile: Alias forUpdate-ProfileFromRemote. Downloads the latest profile version from GitHub and reloads it.
Double-click install.bat (or run it from cmd). It bootstraps everything from a clean machine:
-
Checks for PowerShell 7 — skips ahead if
pwsh.exeis already onPATH. -
Installs it via
winget(Microsoft.PowerShell) with source/package agreements auto-accepted. -
Falls back to a direct MSI download if
wingetis unavailable or fails. It queries the PowerShell GitHub releases API for the latest release, picks the MSI matching the CPU architecture (x64,arm64, orx86), downloads it to%TEMP%, and installs it silently withmsiexec /qn /norestart ADD_PATH=1(prompts for elevation; exit code3010= reboot pending is treated as success). The MSI is deleted afterward. -
Refreshes
PATHfrom the registry (Machine + User) so the freshly installedpwsh.exeis usable without reopening the window. -
Installs the profile to every host — resolves the real
Documentslocation via$PROFILE.CurrentUserCurrentHost(so OneDrive-redirected folders work), then writes to:Documents\PowerShell\Microsoft.PowerShell_profile.ps1(PowerShell 7)Documents\PowerShell\Microsoft.VSCode_profile.ps1(PowerShell 7 in the VS Code extension host)Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1(Windows PowerShell 5.1)Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1(Windows PowerShell 5.1 in the VS Code extension host)
Each existing file is backed up to
*.bak_<timestamp>first, and the profile is written as UTF-8 with BOM with CRLF line endings so Windows PowerShell 5.1 reads it correctly.
Start a new pwsh, powershell, or VS Code terminal session afterward to load the profile.
- Clone this repository and navigate into the directory.
- Run the following command to symlink your profile:
# Run in PowerShell as Administrator inside the repo folder
New-Item -ItemType SymbolicLink -Path $PROFILE -Value "$PWD\Microsoft.PowerShell_profile.ps1" -Force- PowerShell: Supports Windows PowerShell 5.1 and PowerShell 7+ (Core).
- Winget: Used for automatic installs (Oh My Posh, gsudo, Git,
up). It is optional — every winget call is guarded, so without it the profile still loads and prints a skip message instead of erroring. Oh My Posh falls back to the official per-user MSIX package fromcdn.ohmyposh.dev, andinstall.batfalls back to a direct MSI download for PowerShell 7 itself. - gsudo: Recommended for inline
sudoelevation (installed automatically if missing). - Windows Terminal: Recommended for full font and glyph support.
- JetBrains Mono Nerd Font: The profile configures the terminal to use
JetBrainsMonoNL Nerd Font.
Note: The script modifies Windows Terminal settings (
settings.json) to apply the font. It does not create a backup of the settings, so reviewing theSet-WTAppearancefunction is recommended before running.