Knowledge Walls
John Peter
Pune, Maharashtra, India
How to escape characters in string using MS DOS Commands
6146 Views
Escape characters using ^ Caret symbol  
^ Caret symbol is used to escape special characters in string of ms dos commands. For example > is used to write output to the file but > has to print with the echo command. But it is not escape by echo command because > is used to write echo  output to the file.

 echo welcome > filename.txt
It writes welcome to the file.

 echo a > b means a is big > filename.txt
It write only a to the file. because > has different meaning in the command line. so > has to escape with ^ caret symbol like below.

Valid statement with caret escape character symbol.
 echo a ^> b means a is big > filename.txt

also escape < less than symbol also with ^ caret symbol
echo ^<script^> > hello.html

To escape % symbol in batch file is %%. %% percentage is equals to single %.
Example batch file program
@echo off

echo a is big, which means
echo a ^> b is the expression to test which is big among two numbers.
Demo 
Best Lessons of "MS-DOS Commands"
Top lessons which are viewed more times.
Arithmetic Operators of MS-DOS Commands
Arithmetic Operators of MS-DOS Commands
String manipulation of MS-DOS Commands
String manipulation of MS-DOS Commands
Arithmetic Operators of MS-DOS Commands
Logical Operators of MS-DOS Commands
Relational Operators of MS-DOS Commands
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details