This prompt function does several things, it puts the username,
computername, current directory, time, and system uptime in the title, and
it puts the username, computername, and current directory in the prompt. It
also uses the unix/linux convention of substituting ~ for the home directory
(which you can CD to or copy to, etc. in powershell, e.g. "cd ~\"). Thought
someone might enjoy this. Oh, one more thing, the special ASCII characters
require consolas font be used.
function prompt
{
$computer = get-WMIObject -class Win32_OperatingSystem -computer "."
$lastboottime=[System.Management.ManagementDateTimeconverter]::ToDateTime($computer.lastbootuptime)
$uptime=$(get-date)-$lastboottime
$upstr="$([datetime]::now.toshorttimestring())
$([datetime]::now.toshortdatestring()) up $($uptime.days) days,
$($uptime.hours) hours, $($uptime.minutes) minutes"
$dir = $pwd.path
if ($dir -like "$env:userprofile*")
{
$dir=$dir.tolower().replace("$env:userprofile".tolower(),'~')
}
$retstr = "$env:username@$($env:computername.tolower())?$dir"
if ($global

riginaltitle -eq $null) {$global

riginaltitle =
[console]::title}
[console]::title = "$global

riginaltitle ? $retstr ? $upstr"
return "$retstr?"
}