Skip to content

Instantly share code, notes, and snippets.

@cuibonobo
Created June 13, 2018 18:54
Show Gist options
  • Save cuibonobo/67cbf5056e9a0a7f8bef2052fb8dc835 to your computer and use it in GitHub Desktop.
Save cuibonobo/67cbf5056e9a0a7f8bef2052fb8dc835 to your computer and use it in GitHub Desktop.
Windows CMD.exe customization
@echo off
rem Place this file wherever you want, then create a new `AutoRun` string in
rem `Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor` that points to its location
rem This will print the username in magenta
set userprompt=$E[35m%username%$E[0m
rem This will print the current directory in green
set pathprompt=$E[32m$p$E[0m
rem This will print a linefeed
set linefeed=$_
rem Determine if the current prompt has admin to print `$` or `>`
fltmc >nul 2>&1 && (
set promptchar=$E[36m$$$E[0m$s
) || (
set promptchar=$E[36m$g$E[0m$s
)
rem Set new prompt
PROMPT %userprompt% in %pathprompt%%linefeed%%promptchar%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment