Skip to content

Instantly share code, notes, and snippets.

@koreapyj
Created October 6, 2025 06:03
Show Gist options
  • Save koreapyj/d5f1d0cbc0432aa36f2444f1a7aa3123 to your computer and use it in GitHub Desktop.
Save koreapyj/d5f1d0cbc0432aa36f2444f1a7aa3123 to your computer and use it in GitHub Desktop.
function which {
(Get-Command $args).Source
}
function whoami {
echo $Env:UserName
}
function prompt {
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
Write-Host -NoNewline "$Env:username@$Env:computername" -ForegroundColor Green
Write-Host -NoNewline ":"
Write-Host -NoNewline -ForegroundColor Blue ("$PWD".StartsWith("$HOME") ? ("~"+"$PWD".Substring("$HOME".Length)) : ("$PWD".StartsWith("C:\") ? "$PWD".Substring(2) : $PWD))
Write-Host -NoNewline ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) ? "#" : "$")
return " "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment