Windows curl Batch file Windows curl Batch file shell shell

Windows curl Batch file


simply on one line and put the <> redirection char between " or escape it with ^:

curl -s --user 'api:key-xxxxxxxxxx' https://api.mailgun.net/v3/sandboxbxxxxxxxxxxxxx.mailgun.org/messages -F from="user <email@gmail.com>" -F to="user <email@live.com>" -F subject='Hello' -F text='body!' -F attachment=@test.txt

You can also create variable for each element :

set "$ApiKey=api:key-xxxxxxxxxx"set "$Url=https://api.mailgun.net/v3/sandboxbxxxxxxxxxxxxx.mailgun.org/messages"set "$From=email@gmail.com"....and then curl -s --user '%$ApiKey%' %$Url% -F from="user <%$From%>" -F to= ....