我是個菜鳥,我正在嘗試在 Windows 10 中運行 Linux curl 命令來生成會話密鑰。以下是 Linux 中的命令。
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys"}' http://localhost:9933/
當我在 Windows 命令提示符處運行命令時,我收到以下錯誤。
E:\>curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys"}' http://localhost:9933/
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched close brace/bracket in URL position 18:
author_rotateKeys}'
^
E:\>
知道如何隱藏命令以使用 Windows 10 嗎?我只需要為我需要從 Windows 框連接的節點生成一個密鑰。
uj5u.com熱心網友回復:
如果您沒有 WSL2 設定(如果您需要其他 *nix 工具則很有用),該命令將按原樣作業,或者不想在哪里使用 PowerShell
curl.exe -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys"}' http://localhost:9933/
有效(注意 curl 被 curl.exe 替換,因為在 PowerShell 5.1 中 curl 只是 的別名Invoke-WebRequest,它在 PowerShell 6 及更高版本中被洗掉,但它們不是內置的,安裝時不會替換 PowerShell 5.1),然后在命令提示符下用雙引號替換單引號,對于其中的雙引號,將其轉義(用 \" 替換)
curl -H "Content-Type: application/json" -d "{\"id\":1, \"jsonrpc\":\"2.0\", \"method\": \"author_rotateKeys\"}" http://localhost:9933/
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/448107.html
下一篇:無法卷曲包含gif網址的變數
