On the command line, I like the current timestamp and the allowed drive letters for network drives. To make it more readable, I put it in two lines and played a little with the colors.
With CMD, I ended up with
PROMPT=$E[33m$D$T$H$H$H$S$E[37m$M$_$E[1m$P$G
For PS, I got the same result:
function prompt { $dateTime = get-date -Format "dd.MM.yyyy HH:mm:ss" $currentDirectory = $(Get-Location) $UncRoot = $currentDirectory.Drive.DisplayRoot write-host "$dateTime" -NoNewline -ForegroundColor White write-host " $UncRoot" -ForegroundColor Gray
This is a bit readable :-)
BTW:
- I prefer
powershell_ise.exe $PROFILE over (dumb) notepad - If you like to debug tooltip () with breakpoints, you should rename the request function to something else (or try in another file). Otherwise, you may end up in a loop: when you stop debugging, prompt () is called again, and you stop at the breakpoint again. Very annoying at first ...
Trivia Coder Aug 31 '17 at 8:10 2017-08-31 08:10
source share