Skip to content

Instantly share code, notes, and snippets.

@met
Last active January 22, 2026 01:58
Show Gist options
  • Select an option

  • Save met/173022299df3784492c2121f33f4bd7f to your computer and use it in GitHub Desktop.

Select an option

Save met/173022299df3784492c2121f33f4bd7f to your computer and use it in GitHub Desktop.
Power shell loader. Put into Dokuments\PowerShell\Microsoft.PowerShell_profile.ps1 Will load all .ps1 files from $dotfilesPath
# ------------------------------
# 💡 Main PowerShell profil
# Edit: notepad $PROFILE
# ------------------------------
# Uncomment to show all Write-Verbose output
# $VerbosePreference = 'Continue'
# Set directory with my .ps1 files
$dotfilesPath = "$HOME\GitHub\dotfiles\powershell"
# Load all *.ps1 files found in directory '$dotfilesPath'
if (Test-Path $dotfilesPath) {
Get-ChildItem $dotfilesPath -Filter *.ps1 |
Sort-Object Name |
ForEach-Object {
try {
. $_.FullName
Write-Verbose "Loaded $($_.Name)"
}
catch {
Write-Warning "Failed to load $($_.Name): $($_.Exception.Message)"
}
}
}
else {
Write-Warning "Dotfiles folder not found: '$dotfilesPath'."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment