Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Display each COLORDIR type and colour on its own line.

Aug
2,293
111
I like the /N switch of the PATH command,
which allows me to display each path directory on its own line.

I have duplicated this,
to the best of my ability,
to work with each COLORDIR type/colour on its own line.
Code:
@setlocal
@echo off
:: Batch Name: colordir.btm

Gosub ColorDir2File
Gosub File2ColorDir

defer type %temp\colordir.txt
endlocal
quit

:ColorDir2File
set ColorDirCount=%@words[";",%Colordir]
set ColorDirCount=%@DEC[%ColorDirCount]
if exist %temp\colordir.txt del /q %temp\colordir.txt
do kount=0 to %ColorDirCount
  echo %@word[";",%kount,%ColorDir] >> %temp\colordir.txt
enddo
Return

:File2ColorDir
unset colordir
do c in @%temp\colordir.txt (set COLORDIR=%COLORDIR;%c)
::
:: Remove the first ; character
::
set colordir=%@right[-1,%colordir]
Return

Example output;
Code:
R:\>colordir
dll:bri yel on bla
hrb:bri whi on bla
EXETYPE_WIN32CUI:blue
EXETYPE_WIN32GUI:bri blue
EXETYPE_WIN64GUI:bri red
EXETYPE_WIN64CUI:red
EXETYPE_DOS:bri cya

This display format makes it easier to see what colour I have assigned to what file type.

Joe
 
Can't you just use %@replace[;,^n,%colordir]?

I have my directory colors set in the configuration rather than the colordir variable, so I can't test it. But the same thing with %path works.

>echo %@replace[;,^n,%path]
...
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\FPC\3.2.2\bin\i386-Win32
...
 
Thanks,
one line of code,
instead of many lines of code.

Joe
 
Back
Top