Created
June 2, 2018 13:43
-
-
Save xorxornop/a321c03ef5088da03e1de4c7749396fd to your computer and use it in GitHub Desktop.
Powershell profile 'subprofile' dot-sourcing functionality
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Any/all additional functionality desired for the profile may be added as seperate files in a subfolder (name specified below) for the sake of tidiness and ease of switching out functionality: | |
$subprofileScriptFolderName = "SubprofileScripts" | |
# Find any sub-profile scripts found in the relevant subfolder, should it exist and contain '*.ps1' scripts, and then dot-source each of them: | |
Resolve-Path -Path "$(Split-Path -Path $profile -Parent)\$subprofileScriptFolderName\*" | Where-Object {$_.Path.EndsWith(".ps1")} | ForEach-Object { | |
. $_.Path | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment