PSDefaultProfile.ps1
function Set-PSHost_DefaultSettings { if ( Test-Powershell_ISE ) { $codeSrcPath = 'c:\code' if (test-path $codeSrcPath) { Set-Location $codeSrcPath } $Host.UI.RawUI.BackgroundColor = 'Black' $host.PrivateData.ErrorBackgroundColor = "red" $host.PrivateData.ErrorForegroundColor = "white" } } function Add-PSProfile_Ensure { if ( -not $profile ) { return } $thisFile = ( Get-PSCallStack )[0].ScriptName if ( -not ( Test-Path $profile ) ) { $folderProfile = Split-Path $profile -Parent if (-not ( Test-Path $folderProfile ) ) { mkdir $folderProfile } Copy-Item $thisFile -Destination $profile -Force $enc = Get-FileEncoding $thisFile "`nSet-PSHost_DefaultSettings`n" | Out-File $profile -Encoding $enc -Append } } |