Page 1 of 1

echo vertical line from switchs

Posted: 06 May 2010 11:21
by milanka
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)

Re: echo vertical line from switchs

Posted: 06 May 2010 12:57
by jeb
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

Re: echo vertical line from switchs

Posted: 06 May 2010 13:18
by milanka
thanks jeb, working

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

Re: echo vertical line from switchs

Posted: 12 May 2010 11:10
by avery_larry
could also do:

@echo %~1

and then:

runme "echo all ^|"