![](/img/trans.png)
[英]How to run a cURL command for downloading data from a text file in Windows command prompt?
[英]Not able to run curl command from windows command prompt but can run it from cygwin drive
當我從 windows 命令提示符運行命令時:sh./abc.sh
出現以下錯誤:
curl: option --compressed: the installed libcurl version doesn't support this
curl: try 'curl --help' for more information
我能夠從 cygwin 驅動器運行相同的命令。
我如何運行相同的命令以從 windows 命令提示符運行?
curl 上的命令給出以下結果:
>where curl
C:\Windows\System32\curl.exe
C:\cygwin64\bin\curl.exe
compressed
是 cygwin 提供的 curl 的一個特性。
嘗試從 Cygwin bin 目錄之外的 CMD where
D:\cygwin64>where curl
C:\Windows\System32\curl.exe
D:\cygwin64>cd bin
D:\cygwin64\bin>where curl
D:\cygwin64\bin\curl.exe
C:\Windows\System32\curl.exe
如果要使用 Cygwin 程序,請避免將C:\\Windows\\System32
放在 PATH 中 Cygwin 安裝之前。
我找到了解決方案。 最后,我從 Firefox.network monitor requests 復制的 curl 命令與--compressed
命令一起使用。 安裝一些curl就可以了,我的自帶Git app,所以一般在c:\Program Files\Git\mingw64\bin\
添加到系統的Path環境變量中,一般安裝Git的時候可以添加,不用自己編輯。 重新打開 cmd window。中提琴,它有效! 確保路徑變量高於其他變量,其中可以找到 curl,例如C:\windows\system 32
... 為了確保您的變量可以正常工作,請輸入 cmd curl --version
。 如果它使用的是 Git 中的那個,這意味着支持--compressed
命令的那個應該是這樣的: curl 7.78.0 (x86_64-w64-mingw32) libcurl/7.78.0 OpenSSL/1.1.1k (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.1 libssh2/1.9.0 nghttp2/1.43.0 Release-Date: 2021-07-21
。
雖然 Windows 在 Windows 10 21H1 中是這樣的: curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL Release-Date: 2017-11-14, security patched: 2019-11-05
您也可以在不更改任何環境變量的情況下,通過在命令名稱前輸入完整路徑來調用您希望的任何 curl,例如調用 Git 附帶的一個: c:\Program Files\Git\mingw64\bin\curl
和一個來自系統目錄: c:\windows\system32\curl
,后跟您的命令參數,如--version
或其他。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.