Escaping curl command in Windows

前端 未结 3 1321
走了就别回头了
走了就别回头了 2021-01-13 13:46

I\'m trying to run a curl command from the command line in Windows, but for the life of me I can\'t figure out how I\'m supposed to escape it.

I\'m exec

3条回答
  •  萌比男神i
    2021-01-13 14:00

    Quoting is hell. By "Windows Command Line and your prompt I presume you mean cmd.com ?. That doest quote the same as linux shells.

    For this simplistic experiment I recommend going for 2 kinds of quotes to avoid escaping But even then its unlikely to work

    curl --anyauth --user user:password -X POST -d "{'rest-api':{'name':'BizSimDebug3'}}" -H "Content-type: application/xml" http://localhost:8002/v1/rest-apis
    

    Better luck might be had by going with a unix-like shell such as running cygwin (http://www.cygwin.com/) or maybe xmlsh (www.xmlsh.org) which escape like linux does.

    You really are going to have a nightmare running anything complex through the windows command line natively.

    -David

提交回复
热议问题