echo vertical line from switchs

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
milanka
Posts: 2
Joined: 06 May 2010 11:12

echo vertical line from switchs

#1 Post by milanka » 06 May 2010 11:21

runme.bat:

Code: Select all

echo %*

i start this:
runme.bat echo all ^|

and error at echo with | character
i want this output:
echo all |

and run app.exe with echo all | switches(here maybe %switches:^|=^^^|% ?)
and && too not works, so i want echo the raw text
please help
(and sorry for my bad "english" :D)

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: echo vertical line from switchs

#2 Post by jeb » 06 May 2010 12:57

Hi milanka,

you are on the right path (replace the characters).

runme.bat:

Code: Select all

@echo off
set "var=%*"
set "var=%var:|=^|%
set "var=%var:&=^&%
echo %var%


Code: Select all

runme.bat echo all ^|

RESULT:
echo all |


jeb

milanka
Posts: 2
Joined: 06 May 2010 11:12

Re: echo vertical line from switchs

#3 Post by milanka » 06 May 2010 13:18

thanks jeb, working

but when i don't give parameters for batch, then don't
solved: if DEFINED var ...

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

Re: echo vertical line from switchs

#4 Post by avery_larry » 12 May 2010 11:10

could also do:

@echo %~1

and then:

runme "echo all ^|"

Post Reply