Show bold prompt

This commit is contained in:
Anthony Rose 2022-09-08 16:10:57 +01:00
parent cbb0e7118b
commit f256e00f31

View file

@ -4,17 +4,20 @@
# C:\Users\USERNAME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 # C:\Users\USERNAME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
function Prompt { function Prompt {
if ($IsWindows -or $PSVersionTable.PSVersion -lt [System.Version]"6.0") { if ($IsWindows -and $PSVersionTable.PSVersion -gt [System.Version]"6.0") {
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$env:USERNAME + "@" + $env:COMPUTERNAME.ToLower() + "# " "`e[1m" + $env:USERNAME + "@" + $env:COMPUTERNAME.ToLower() + "# `e[0m"
} else { } else {
$env:USERNAME + "@" + $env:COMPUTERNAME.ToLower() + "> " "`e[1m" + $env:USERNAME + "@" + $env:COMPUTERNAME.ToLower() + "> `e[0m"
} }
} }
elseif ($IsLinux) { elseif ($IsLinux) {
"`e[1m" + $(id -un) + "@" + $(hostname -s) + "> `e[0m" "`e[1m" + $(id -un) + "@" + $(hostname -s) + "> `e[0m"
} }
else {
"PS> "
}
} }
function ADUserInfo { function ADUserInfo {