Show bold prompt
This commit is contained in:
parent
cbb0e7118b
commit
f256e00f31
1 changed files with 6 additions and 3 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue