PowerShell: Manage PowerShell Profiles

By Xah Lee. Date: . Last updated: .

Split Function Definitions in PowerShell Profile into Several Files

if you have a lot PowerShell functions in your Profile (init file), you can organize them by splitting into different files of function definitions.

For example, in your profile file, add

# load PowerShell scripts

@(
    "file_util.ps1",
    "windows_util.ps1",
    "personal.ps1"
) | ForEach-Object {
    . (Join-Path (Split-Path -Parent $PSCommandPath ) $_ )
}

PowerShell: Profile and Script