It seems you're using incomming webhook.
Choose one of following:
a) remove -H 'Content-type: application/json' or change it to -H 'Cotent-type: application/x-www-form-urlencoded'
curl.exe -X POST --data-urlencode "payload={\"channel\": \"#channelname\", \"username\": \"webhookbot\",\"text\": \"%topic\",\"icon_emoji\": \":ghost:\"}" SLACK_WEBHOOK_URL
b) keep content-type as it is, but change --data-urlencode to -d and remove payload= from the data
curl.exe -X POST -H "Content-Type: application/json" -d "{\"channel\": \"#channelname\", \"username\": \"webhookbot\",\"text\": \"%topic\",\"icon_emoji\": \":ghost:\"}" SLACK_WEBHOOK_URL
But if you use Slack API (for example /chat.postMessage):
1) you need to authorize with a token - add curl option -H "Authorization: Bearer YOUR_TOKEN_HERE"
2) don't use --data-urlencode, but -d
from docs: https://api.slack.com/methods/chat.postMessage
When POSTing with application/x-www-form-urlencoded data, the optional attachments argument should contain a JSON-encoded array of attachments. Make it easy on yourself and send your entire messages as application/json instead.
3) remove the from data payload= from data
curl.exe -X POST -H 'Content-Type: application/json' -H "Authorization: Bearer YOUR_TOKEN_HERE" -d "{ \"channel\": \"#channelname\", \"text\": \"message body\", \"username\": \"webhookbot\", \"icon_emoji\": \":ghost:\" }" "https://slack.com/api/chat.postMessage"
@echo offandcurl.exemake this look like a Windows environment.