How can I launch powershell.exe with the “default” colours from the PowerShell shortcut?

前端 未结 9 1369
野趣味
野趣味 2020-12-13 06:56

I\'m attached to the nice blue colour of the PowerShell window when you launch it from one of the pre-installed shortcuts. However, if you manually launch powershell.exe, yo

9条回答
  •  醉话见心
    2020-12-13 07:22

    Edit your profile script (pointed to by $profile) and set the desired colors yourself:

    # set regular console colors
    [console]::backgroundcolor = "darkmagenta"
    [console]::foregroundcolor = "darkyellow"
    
    # set special colors
    
    $p = $host.privatedata
    
    $p.ErrorForegroundColor    = "Red"
    $p.ErrorBackgroundColor    = "Black"
    $p.WarningForegroundColor  = "Yellow"
    $p.WarningBackgroundColor  = "Black"
    $p.DebugForegroundColor    = "Yellow"
    $p.DebugBackgroundColor    = "Black"
    $p.VerboseForegroundColor  = "Yellow"
    $p.VerboseBackgroundColor  = "Black"
    $p.ProgressForegroundColor = "Yellow"
    $p.ProgressBackgroundColor = "DarkCyan"
    
    # clear screen
    clear-host
    

提交回复
热议问题