Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BATCH: How to echo string containing '&' char to a file

I'm trying to write to a file a URL string that has the '&' char in it (using simple 'echo'), problem is that it's a saved char in the command prompt so it fails.

Is there any way to tell the command prompt that it's part of the string.

Example:

echo www.google.com/search=make&peace > love.txt

I'll get an error indicating that "peace" is not a recognized command.

Thanks!

like image 245
orshachar Avatar asked Nov 29 '11 23:11

orshachar


1 Answers

cmd uses ^ as the escape character, so

echo www.google.com/search=make^&peace > love.txt
like image 163
Cat Plus Plus Avatar answered Dec 02 '22 22:12

Cat Plus Plus