Escape special characters for curl

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
maskull
Posts: 1
Joined: 12 Jun 2014 05:49

Escape special characters for curl

#1 Post by maskull » 12 Jun 2014 06:04

Hello all,

I am trying to call curl for Windows from a .bat/.cmd script but I am getting lost escaping those pesky special chars.
It looks something like this:

Code: Select all

@echo off
set Name=My Name
set Email=email@server.com
set Variable=test

curl --data-urlencode \"Name^=%Name%^&EMail^=%Email%^&variable^=%Variable%^&click^=Send+request\" http://example.com:8080/form.asp


It seems the line gets broken where the email variable is so everything after "@" is treated by curl as a remote host.
Any help will be appreciated.

PS. The variables will be take from user input.

carlos
Expert
Posts: 503
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Escape special characters for curl

#2 Post by carlos » 12 Jun 2014 07:51

Try:

Code: Select all

 "Name=%Name%&EMail=%Email%&variable=%Variable%&click=Send+request"

Post Reply