Skip to content

Instantly share code, notes, and snippets.

@trzecieu
Created July 19, 2016 14:07
Show Gist options
  • Save trzecieu/654b53381f7bfc8e87d80c0a9af6f25e to your computer and use it in GitHub Desktop.
Save trzecieu/654b53381f7bfc8e87d80c0a9af6f25e to your computer and use it in GitHub Desktop.
@echo off
set CPath=$E[92m
set CPathAdmin=$E[93m
set CInd=$E[90m
set CReset=$E[90m
rem Simple "ver" prints empty line before Windows version
rem Use this construction to print just a version info
cmd /d /c ver | "%windir%\system32\find.exe" "Windows"
rem Now we form the command prompt
rem Carriage return and `$` or `>`
rem Spare `$E[90m` was specially added because of GitShowBranch.cmd
if "%ConEmuIsAdmin%" == "ADMIN" (
set ConEmuPrompt0=$_%CInd%$$$E[m$S
) else (
set ConEmuPrompt0=$_%CInd%$G$E[m$S
)
rem Followed by colored `Path`
set ConEmuPrompt1=%ConEmuPrompt0%%CPath%$P%CReset%
if NOT "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
if "%PROCESSOR_ARCHITEW6432%" == "AMD64" if "%PROCESSOR_ARCHITECTURE%" == "x86" (
rem Use another text color if cmd was run from SysWow64
set ConEmuPrompt1=%ConEmuPrompt0%%CPathAdmin%$P%CReset%
)
)
rem Finally reset color and add space
set ConEmuPrompt3=$E]9;12$E\
if /I "%~1" == "/git" goto git
if /I "%~1" == "-git" goto git
goto no_git
:git
call "%~dp0GitShowBranch.cmd" /i
goto :EOF
:no_git
PROMPT %ConEmuPrompt1%%ConEmuPrompt3%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment