1

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...

Bad
  • 4,967
  • 4
  • 34
  • 50
  • Possible duplicate of [Running curl via powershell - how to construct arguments?](http://stackoverflow.com/questions/30807318/running-curl-via-powershell-how-to-construct-arguments) – user4003407 Jan 27 '17 at 17:07
  • Possible duplicate of [Remove alias in script](http://stackoverflow.com/questions/24347758/remove-alias-in-script) – Mofi Jan 27 '17 at 17:24

1 Answers1

1

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
Luca Clavarino
  • 404
  • 1
  • 4
  • 16