2 # . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1
5 # Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process {
6 # $Path = Split-Path -Path $_.Directory -Parent
7 # $env:PSModulePath = $env:PSModulePath + ";$($Path)"
9 # $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'')
11 # No longer needed in PowerShell 7
12 if($IsWindows -eq "") {
13 # Bootstrap for older PowerShell
14 Write-Host "***Bootstrapped Is Windows for older PowerShell***"
15 $IsWindows = ($env:OS -eq "Windows_NT")
20 Write-Host "***Is Windows***"
25 # Some Paths that are annoying to find/restore if the installer fails
26 $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all
27 $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice.
28 $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice.
29 $ENV:PATH+=";C:\bin\x16emu" # Package management is nice.
30 $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in.
34 $env:Journal = "~\Journal\2021" # allows cd $env:journal
35 $env:minion = "$env:src\minion"
37 # Import some home grown PowerShell modules, if they are installed.
39 $modPaths = Get-Childitem -Path "$env:src\dotfiles\psmodules"
40 $modPaths += Get-Childitem -Path "$env:minion\psmodule"
42 # Windows Only Modules
44 $modPaths += Get-Childitem -Path "$env:src\dotfiles\win_psmodules"
46 if($modPaths.length -eq 0){
47 Write-Host "No modules found."
49 $modPaths | ForEach-Object {
50 $fileName = $_.FullName
51 Import-Module $fileName
52 Write-Host ">> Loaded $fileName"
57 # Linux-like up/down in shell
58 Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
59 Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
60 Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log
62 # Minion alias commands - 'today'
63 # . C:\src\minion\profiles\alias.ps1
64 . $env:minion\profiles\alias.ps1
65 # Add Minion go executable to path.
66 . $env:minion\profiles\path.ps1
68 Write-Host "+ Added minion command to path."
69 $ENV:PATH+=";$env:minion\go" # Flag to ensure my profile kicked in.
72 New-Alias which get-command
74 # Delay loading PoshGit for speed.
75 function Enable-PoshGit {
76 Import-Module posh-git
78 New-Alias pg Enable-PoshGit
79 Write-Host "+ Type 'pg' to enable PoshGit"
82 if((Get-Location).Path -eq $HOME){