Write symbol ">"

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
walter4991
Posts: 21
Joined: 11 Dec 2010 10:17

Write symbol ">"

#1 Post by walter4991 » 16 Jan 2011 02:19

Hello guys, I have something to ask:
how do I write the symbol ">" in a batch file, for example:

Code: Select all

tree echo>nul>>test.bat


The command in the file bat write only

Code: Select all

tree
, then how do I write ">nul" ???
Thank's...

amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

Re: Write symbol ">"

#2 Post by amel27 » 16 Jan 2011 04:14

by "^" symbol before ">"

Code: Select all

echo tree ^>nul>>test.bat

walter4991
Posts: 21
Joined: 11 Dec 2010 10:17

Re: Write symbol ">"

#3 Post by walter4991 » 16 Jan 2011 04:41

thanks a lot, it works ... but what does it mean "^" ???

amel27
Expert
Posts: 177
Joined: 04 Jun 2010 20:05
Location: Russia

Re: Write symbol ">"

#4 Post by amel27 » 16 Jan 2011 06:10

Escape special characters,
read this: http://www.dostips.com/?t=Snippets.Escape

walter4991
Posts: 21
Joined: 11 Dec 2010 10:17

Re: Write symbol ">"

#5 Post by walter4991 » 16 Jan 2011 06:46

Thank you very very much... :D

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

Re: Write symbol ">"

#6 Post by jeb » 16 Jan 2011 12:16

At the page are missing some more cases.

Code: Select all

SETLOCAL DISABLEDELAYEDEXPANSION
echo 1 ^^^^ "^^^^"
echo 2 ^^^^ "^^^^" ^^!

echo *******
SETLOCAL ENABLEDELAYEDEXPANSION
echo 3 ^^^^ "^^^^"
echo 4 ^^^^ "^^^^" ^^!

---- OUTPUT ----

1 ^^ "^^^^"
2 ^^ "^^^^" ^!
*******
3 ^^ "^^^^"
4 ^ "^^" !


As you can see, number 4 seems to be really mysterious.
To understand the escape mechanism is one of the major keys of batch files.

hope it helps
jeb

Post Reply