0

If you have maybe a code like this

set "CONTENT_LENGTH=24" & echo first=1&second=2&third=3

I want the echo to echo with the &

lospejos
  • 1,976
  • 3
  • 19
  • 35
surge10
  • 622
  • 6
  • 18
  • `echo first=1^&second=2^&third=3` – Niet the Dark Absol Apr 29 '18 at 17:08
  • Just found it. ```set "CONTENT_LENGTH=24" & echo first=1^^^&second=2^^^&third=3```. My own wasn't working with the single and double quotes escapes maybe because I was using a PIPE. I used the triple ^ (hats) to do this – surge10 Apr 29 '18 at 23:02

1 Answers1

4

Two ways you could do this.

Escape characters

In Windows batch files it seems to be the ^ character, so you'd just stick a ^ before your special character.

This page seems to cover the exceptions: http://www.robvanderwoude.com/escapechars.php

On OS X/Linux, use backslashes: echo three\&four

Wrap the parameter phrase in quotes.

echo "three&four"

This should work on either system.

Gerhard
  • 22,678
  • 7
  • 27
  • 43