Bad
Bad

Reputation: 5299

Wget Path Environment Variable on Windows

On Windows 10, I installed Wget by choco install wget.

Then I added wget.exe location folder to Path Environment Variable (which at the time of installation was C:\ProgramData\chocolatey\lib\Wget\tools).

However, Wget commands using PowerShell / cmd, like wget --help and wget [any_link] don't work right away, they work only if I type wget.exe --help and wget.exe [any_link]

wget --help error:

wget : The remote name could not be resolved: '--help'
At line:1 char:1
+ wget --help
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

How to disable explicit .exe extension? I know it's a minor problem, but when you do not use Wget very often, each time it takes you some time recollecting this annoying detail...

Upvotes: 1

Views: 2824

Answers (1)

Luca Clavarino
Luca Clavarino

Reputation: 434

This is because Powershell already has its own wget command defined, that actually is an alias of Invoke-WebRequest cmdlet. If you remove the alias you can use wget.exe command without the file extension. Just try

Remove-Item Alias:wget
wget --help

Upvotes: 2

Related Questions