Echoing '|' Doesnt work

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
phillid
Posts: 109
Joined: 03 Apr 2010 20:27
Location: Wellington, New Zealand
Contact:

Echoing '|' Doesnt work

#1 Post by phillid » 31 May 2010 22:33

Hello all. I've been trying to set one of my batch files screen output so it is easier to read. I've decided to have tables made out of + - | etc, but I encountered a problem:

Code: Select all

echo | Output

This didn't work because the | is meant to be used like:

Code: Select all

help command | MORE

So I put a ^ like this:

Code: Select all

echo ^| Output

This still doesn't work.

Please Help!

Thanks,
Phillid

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Echoing '|' Doesnt work

#2 Post by aGerman » 01 Jun 2010 11:24

What exactly does output mean? Your standard output is the the batch window. The pipe (|) is for redirecting the stdOut of one command to a second command.

Regards
aGerman

phillid
Posts: 109
Joined: 03 Apr 2010 20:27
Location: Wellington, New Zealand
Contact:

Re: Echoing '|' Doesnt work

#3 Post by phillid » 01 Jun 2010 18:38

I mean It will put something like the following on-screen:

Code: Select all

+--TITLE--+
|Data     |
|Data     |
+---------+

But I stuffs-up when trying to echo a |

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

Re: Echoing '|' Doesnt work

#4 Post by DosItHelp » 01 Jun 2010 19:27

Code: Select all

@echo off
for %%A in (
  "+--TITLE--+"
  "|Data     |"
  "|Data     |"
  "+---------+"
) do echo.%%~A

DosItHelp?

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

Re: Echoing '|' Doesnt work

#5 Post by avery_larry » 02 Jun 2010 13:58

echo.^| whatever ^|

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Echoing '|' Doesnt work

#6 Post by aGerman » 02 Jun 2010 14:51

Another possibility could be to use frame characters. Try this

Code: Select all

@echo off &setlocal
chcp 437>nul
echo.
echo ÉÍËÍ»
echo º1º2º
echo ÌÍÎ͹
echo º3º4º
echo ÈÍÊͼ
echo.
echo ÚÄÂÄ¿
echo ³1³2³
echo ÃÄÅÄ´
echo ³3³4³
echo ÀÄÁÄÙ
echo.
pause


Regards
aGerman

Post Reply