Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO Off & Goto :main
- +------------------------------------------------------------------------------------------------+
- :ColorString
- (For %%C in (%~1)Do Set "rv=!rV!%/E%[!#A!m%%~C"& Set /A "#A+=1"& IF "!#A!"=="37" (Set #A=31))
- Exit /B 0
- +------------------------------------------------------------------------------------------------+
- :main
- For /F %%a in ('echo prompt $E ^| cmd')do (Set "/E=%%a")
- Set "Off=%/E%[0m" &Set "#A=31"
- Set "ColLETTERS=Set "Rv="& Set "#A=31" & (For %%A in ("$V")Do Set "Word=!%%~A!" & For %%B In (0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z . - _ [ ] / \ ":")Do Set "Word=!Word:%%~B=%%~B !") & (Call :ColorString "!Word!" & Set "#$V#=!rV!")"
- Set "ColWORDS=Set "#$V#=!$V!"&For %%G in ("!$V:\=;!")Do (For %%v in (%%~G)Do (Set "Rv=" & Call :Colorstring "%%~v" &For %%x in (!Rv!)Do (Set "#$V#=!#$V#:\%%~v=%Off%\%%~x!")))"
- Setlocal EnableDelayedExpansion
- %ColWORDS:$V=CD%
- %ColLETTERS:$V=ComputerName%
- rem // colored strings from the above two macro's are returned in %#VARNAME#%
- rem // Prompt macro will fail in an environment where delayed expansion is enabled.
- rem // Alternate prompt ::: Endlocal & Set "C_Prompt=Prompt %/E%[36m%Username% %/E%[37mOn: %#ComputerName#%%/E%[37m In: %/E%[36m%#CD#%%/E%[90m $$%/E%[36m^> %/E%[33m"
- Endlocal & Set "C_Prompt=Prompt %#CD#%%/E%[90m $$%/E%[36m^> %/E%[33m"
- %C_Prompt%
- Goto :Eof
- For random Color changes, replace the contents of the colorstring function with the below routine
- +------------------------------------------------------------------------------------------------+
- (For %%C in (%~1)Do Set /A "R=!Random! %% 255 + 40,G=!Random! %% 205 + 40,B=!Random! %% 205 + 40" & Set "rv=!rV!%/E%[38;2;!R!;!G!;!B!m%%~C"& Set /A "#A+=1"& IF "!#A!"=="37" (Set #A=31))
- Exit /B 0
- +------------------------------------------------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement