Skip to content

Pretty PowerShell that looks good and functions almost as good as Linux terminal

License

Notifications You must be signed in to change notification settings

ruxunderscore/powershell-profile

Repository files navigation

🎨 PowerShell Profile (Pretty PowerShell)

A functional and enhanced PowerShell environment, initially based on ChrisTitusTech's Powershell Profile, now providing a structured and customizable experience. This repository contains two key profile components: a self-updating base profile and an advanced user profile with extra features.

Requirements

  • Powershell 7
  • Administrator

✨ Features

  • Base Profile (Microsoft.Powershell_profile.ps1):
    • Auto-updates from this repository.
    • Automatically loads a user-created CustomProfile.ps1 if found in the same directory ($PSScriptRoot, typically Documents\PowerShell).
    • Integrations: Starship, Zoxide (auto-install attempt), Terminal-Icons, Chocolatey.
    • PSReadLine enhancements (custom colors, keybindings, history).
    • Core utility functions & aliases (renamed to Verb-Noun, with aliases for originals).
    • Comment-Based Help for functions.
    • Admin prompt indicator.
  • Advanced Profile (profile.ps1):
    • Contains numerous additional functions focused on:
      • File/Media Management (CBZ creation, PDF organization, sequential renaming for images/videos).
      • Image Processing (via ImageMagick dependency).
      • Video Info (via ffprobe dependency).
      • Git integration helpers.
      • Folder creation utilities.
      • And more...
    • Extensive Comment-Based Help.
    • Robust dependency checking for its advanced features.
    • Optionally installed during setup to $PROFILE.CurrentUserAllHosts.

📜 Profile Scripts

This repository contains the following core scripts:

  • Microsoft.Powershell_profile.ps1: The self-updating base profile installed to $PROFILE. See features above. Loads CustomProfile.ps1 if present in the same directory.
  • profile.ps1: The advanced user profile script. (See Documentation)
  • HelperFunctions.ps1: Shared functions required by both profile scripts. Automatically updated.
  • setup.ps1: The setup script used for installation.
  • CustomProfile.ps1: (User-Created) Not included. You create this file for your persistent settings (see Customizing Your Setup).

⚡ One Line Install (Elevated PowerShell Recommended)

Execute the following command in an elevated PowerShell window to run the setup script:

PowerShell

irm "https://undersc.red/profile" | iex

What the installer does:

  1. Checks for Admin rights and Internet connectivity.
  2. Installs dependencies: Chocolatey, Winget packages (Starship, Zoxide, Eza), PowerShell Modules (Terminal-Icons), and Nerd Fonts (Cascadia Code).
  3. Installs the Shared Helper Functions (HelperFunctions.ps1) required by the profiles.
  4. Installs the Base Profile (Microsoft.Powershell_profile.ps1) (which uses the helpers) to $PROFILE, backing up any existing file. This base profile will auto-update and automatically load CustomProfile.ps1 if you create it in the same directory.
  5. Prompts you whether to download and install the Advanced Profile (profile.ps1) (which also uses the helpers) to $PROFILE.CurrentUserAllHosts, backing up any existing file.

Restart your PowerShell session after the setup completes!

🔧 Customizing Your Setup

This PowerShell environment uses a layered approach for profile settings:

  1. Base Profile ($PROFILE)

    • File: Microsoft.Powershell_profile.ps1
    • Location: Managed by the project, typically in Documents\PowerShell.
    • Persistence: Auto-updates from the repository. Loads CustomProfile.ps1 if found.
    • ⚠️ DO NOT EDIT THIS FILE DIRECTLY! Your changes will be overwritten by project updates.
  2. Advanced Profile ($PROFILE.CurrentUserAllHosts)

    • File: profile.ps1 (if advanced installed).
    • Location: $PROFILE.CurrentUserAllHosts (often the same directory as $PROFILE, but a different file path variable).
    • Persistence: Holds user settings, but may be overwritten if you run the setup.ps1 script again and choose to install/reinstall the advanced profile (profile.ps1).
    • Usage: Good for temporary settings or customizations related to the advanced profile if you installed it. Use the Edit-Profile or ep alias to edit this file.
  3. User Custom Profile (CustomProfile.ps1)

    • File: CustomProfile.ps1 (or any name you choose).
    • Location: You create this file yourself and place it in the same directory as the Base Profile (typically ~\Documents\PowerShell\CustomProfile.ps1). You can use (Get-Item $PROFILE).FullName to find yours.
    • Persistence: Separate from the auto-updating files (Microsoft.Powershell_profile.ps1, HelperFunctions.ps1) and never overwritten by their update process.
    • Usage: Ideal for your most important, persistent personal aliases, functions, environment variables, and settings that should always remain untouched by this project's base file updates.
    • Loading: The Base Profile (Microsoft.PowerShell_profile.ps1) automatically loads this file if it exists in the same directory ($PSScriptRoot) during startup. No manual loading steps are needed.

Summary:

  • Use $PROFILE.CurrentUserAllHosts (via Edit-Profile or ep) for general customizations or settings related to the optional advanced profile, knowing setup might overwrite it.
  • Create your own CustomProfile.ps1 in the main PowerShell profile directory (e.g., Documents\PowerShell\) for settings that must never be overwritten by project updates. The base profile will load it automatically.

Examples for Your User-Created CustomProfile.ps1:

# Add personal aliases that should never change
Set-Alias -Name myproj -Value "Set-Location D:\Work\MyProject"

# Define essential personal functions
function Connect-MyVPN {
	# Commands to connect to your personal VPN
}

# Set crucial environment variables
$env:MY_SECRET_TOOL_PATH = "C:\Tools\SecretTool"

Write-Host "Loaded PERSONAL CustomProfile.ps1!" -ForegroundColor Cyan

Now, enjoy your enhanced and stylish PowerShell experience! 🚀

About

Pretty PowerShell that looks good and functions almost as good as Linux terminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published