Farbe in Batch
Hallo,
Ich hatte schon einmal eine Frage hier gestellt und habe auch sehr schnell eine Antwort bekommen und da dachte ich mir ich stelle noch eine Frage.
So jetzt zur Frage:
Bekommt man es in Batch hin nur BESTIMMTE Wörter in Batch farbig zu machen?
MfG Marlon
Ich hatte schon einmal eine Frage hier gestellt und habe auch sehr schnell eine Antwort bekommen und da dachte ich mir ich stelle noch eine Frage.
So jetzt zur Frage:
Bekommt man es in Batch hin nur BESTIMMTE Wörter in Batch farbig zu machen?
MfG Marlon
Please also mark the comments that contributed to the solution of the article
Content-Key: 291483
Url: https://administrator.de/contentid/291483
Printed on: April 24, 2024 at 23:04 o'clock
5 Comments
Latest comment
Moin,
geht
Quelle: Funktionen stammen von http://www.dostips.com/forum/viewtopic.php?f=3&t=4018
Gruß jodel32
geht
Quelle: Funktionen stammen von http://www.dostips.com/forum/viewtopic.php?f=3&t=4018
@echo off & setlocal
call :initColorPrint
call :colorPrint 0c "Das "
call :colorPrint 0e "ist "
call :colorPrint 09 "ein "
call :colorPrint 0b "Test"
call :cleanupColorPrint
exit /b
REM ####### FUNKTIONEN ##################
:colorPrint Color Str [/n]
setlocal
set "str=%~2"
call :colorPrintVar %1 str %3
exit /b
:colorPrintVar Color StrVar [/n]
if not defined %~2 exit /b
setlocal enableDelayedExpansion
set "str=a%DEL%!%~2:\=a%DEL%\..\%DEL%%DEL%%DEL%!"
set "str=!str:/=a%DEL%/..\%DEL%%DEL%%DEL%!"
set "str=!str:"=\"!"
pushd "%temp%"
findstr /p /A:%1 "." "!str!\..\x" nul
if /i "%~3"=="/n" echo(
exit /b
:initColorPrint
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do set "DEL=%%a"
<nul >"%temp%\x" set /p "=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%.%DEL%"
exit /b
:cleanupColorPrint
del "%temp%\x"
exit /b
Die Funktion stammt aus dem DOS-Tips Forum, hatte ich noch vergessen einzutragen, Quelle ist oben ergänzt:
http://www.dostips.com/forum/viewtopic.php?f=3&t=4018
http://www.dostips.com/forum/viewtopic.php?f=3&t=4018