Skip to content

Instantly share code, notes, and snippets.

@kowalski7cc kowalski7cc/LICENSE
Created Dec 10, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.