You are not logged in.
Pages: 1
I found the following code but i'm not sure why it doesn't work it gives me this out put
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\User>ncol hello 04
'"hello.@"' is not recognized as an internal or external command,
operable program or batch file.
FINDSTR: Cannot open *.@
here's the code
@echo off
setlocal
if "%~1"=="/?" (
echo.
echo ncol ["Text"] [Colour]
echo.
echo "Text" - The text you want displayed in another colour.
echo Remember that spaces cannot be added if you don't put the text in
echo quotation marks (""^).
echo.
echo Colour - The hexadecimal colour code that you want the text to be changed into.
echo For more information of colour codes, see "color /?"
echo.
exit /b
)
for /f "delims=#" %%i in ('"prompt #$H# &for %%b in (1) do rem"') do set "bs=%%i"
"%~1.@" set /p "=.%bs%%bs%%bs%%bs%"
findstr /p /a:%2 . "*.@"
endlocal
del "*.@"
@echo on
@exit /b
Here is the final code
@echo off
setlocal
if "%~1"=="/?" (
echo.
echo ncol ["Text"] [Colour]
echo.
echo "Text" - The text you want displayed in another colour.
echo Remember that spaces cannot be added if you don't put the text in
echo quotation marks (""^).
echo.
echo Colour - The hexadecimal colour code that you want the text to be changed into.
echo For more information of colour codes, see "color /?"
echo.
exit /b
)
for /f "delims=#" %%i in ('"prompt #$H# &for %%b in (1) do rem"') do set "bs=%%i"
>"%~1.@" set /p "=.%bs%%bs%%bs%%bs%"<nul
findstr /p /a:%2 . "*.@"
endlocal
del "*.@"
@echo on
@exit /b
Last edited by Batcher (04 Dec 2015 17:56)
Offline
This line is where the error is coming from:
"%~1.@" set /p "=.%bs%%bs%%bs%%bs%"
Your intent on that line is unclear.
The problem of misusing "findstr" to produce arbitrary coloured output has been solved quite exhaustively elsewhere:
cmd | *sh | ruby | chef
Offline
It should be
>"%~1.@" set /p "=.%bs%%bs%%bs%%bs%"<nul
Offline
Pages: 1