Skip to content

Commit 312fb76

Browse files
author
0xfab1
committed
Add PowerShell section clarifying curl alias and executable distinction
1 parent a8611f7 commit 312fb76

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

docs/tech/tools/cli/curl.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,33 @@ curl -x http://proxyserver:port https://example.com
181181

182182
### More
183183

184-
- [Use curl with ssl](https://curl.se/docs/sslcerts.html)
184+
- [Use curl with ssl](https://curl.se/docs/sslcerts.html)
185+
186+
Absolutely! Here’s the technical blog section in **Markdown**:
187+
188+
## Is curl in PowerShell an Alias or the Real Deal?
189+
190+
On Windows, running `curl` in PowerShell might not always do what you expect. That’s because older versions of PowerShell define `curl` as an alias for `Invoke-WebRequest`, while modern Windows also ships with the real cURL executable. To avoid confusion, here’s a simple PowerShell snippet to check exactly what `curl` points to in your session:
191+
192+
```powershell
193+
$curlCmd = Get-Command curl -ErrorAction SilentlyContinue
194+
195+
if ($null -eq $curlCmd) {
196+
Write-Output "'curl' is not available in your PATH."
197+
}
198+
elseif ($curlCmd.CommandType -eq 'Alias') {
199+
Write-Output "'curl' is a PowerShell alias for '$($curlCmd.Definition)'."
200+
}
201+
elseif ($curlCmd.CommandType -eq 'Application') {
202+
Write-Output "'curl' is the real executable located at: $($curlCmd.Source)"
203+
}
204+
else {
205+
Write-Output "Unexpected command type: $($curlCmd.CommandType)"
206+
}
207+
```
208+
209+
Just run this script in your PowerShell window, and you’ll immediately know whether `curl` is an alias or the real command-line tool. If it’s an alias and you need the actual cURL, you can always remove the alias for your session with:
210+
211+
```powershell
212+
Remove-Item alias:curl
213+
```

0 commit comments

Comments
 (0)