Author Options:

Batch Files Answered

How do you get a batch file to emit text in multiple colors?


I don't know if it still works, but the command-line console *used* to support a bunch of ANSI escape sequences which could do things like setting its color, moving the cursor, and so on. https://secure.wikimedia.org/wikipedia/en/wiki/ANSI_escape_code

wanna to make a batch file with connect using different credential.
i have a folder on the server which i want to show the user , but dont wanna him to see any other stuff on the server just that folder, please help

I've made a short and simple (jokes) batch file to help you:

@echo off
for /f "delims=#" %%a in ('"prompt #$H# &for %%b in (1) do rem"') do set "bs=%%a"
setlocal enabledelayedexpansion
color 0a
title Colour Changer

set /p text=Type the text you want to change colours here:
set /p colour=Type the colour code here:

"%text%.@" set /p "=.%bs%%bs%%bs%%bs%"

findstr /p /a:%colour% . "*.@"
del %text%.@
pause >nul
goto start

It works like a charm, assuming you know the colour command...

If you don't, type "color /?" in at your command prompt.