Skip to content

Instantly share code, notes, and snippets.

@kowalski7cc
Created December 10, 2018 16:12
Show Gist options
  • Save kowalski7cc/20c6dafeacbcfd4ac44218bd068a0365 to your computer and use it in GitHub Desktop.
Save kowalski7cc/20c6dafeacbcfd4ac44218bd068a0365 to your computer and use it in GitHub Desktop.
PowerShell Bash prompt

PowerShell Bash prompt

Inspired by DeadlyBrad42 Custom Powershell Prompt

How 2 install

The easiest way to install it is to notepad $PROFILE and copy the script in. The Prompt function that we just added will be run on the next startup of Powershell.

Features

  • Bash prompt like

License

Read LICENSE file

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
function prompt
{
# Based on https://gist.github.com/DeadlyBrad42/ab69aedcd9741df3151b, thanks DeadlyBrad42!
# One liner bro!
return ([Environment]::UserName + "@" + [System.Net.Dns]::GetHostName() + ":" + $(get-location).Path.Replace("C:\Users\$([Environment]::UserName)","~") + (&{If((New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){"#"}Else{"$"}})) + " ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment