The two things that break
The backslashes at the end of each line
The backslashes at the end of each line
In a Mac or Linux shell, a trailing
\ means “this command continues on the next line”. Windows Command Prompt has no such thing, so it reads each line as a separate command — and all but the first are nonsense.That is why the Windows examples are one long line. It looks worse; it works.The single quotes around the JSON
The single quotes around the JSON
Mac and Linux shells treat
'...' as “one piece of text, leave it alone”. Windows does not treat the single quote as a quoting character at all, so the JSON body arrives torn into fragments.On Windows the body has to be wrapped in double quotes, with every double quote inside it escaped as \".Use Command Prompt
Press Start, typecmd, and open Command Prompt. Paste the cURL (Windows) example there, as one line.
cURL (Windows)
cURL has shipped with Windows since Windows 10 version 1803, so there is nothing to install. Check with
curl --version — if it prints a version number you are ready.If you would rather stay in PowerShell
Use PowerShell’s own command instead of fighting it.Invoke-RestMethod builds the JSON for you, so there is no quoting to get wrong:
PowerShell
` at the end of each line is PowerShell’s line continuation — its equivalent of the \ you see in the Mac examples.
What each one looks like when it goes wrong
Putting it in a .bat file
If you save a command into a .bat file rather than typing it, one more rule applies: a percent sign in your message text has to be doubled. 50% off becomes 50%% off. At the Command Prompt itself you can type it once.

