'powershell command line parameter are executed in uppercase?

I would like to use a WGET command line program under Windows in a powershell script.

example : wget https://domain-name/file_01.pdf -o wgetlog.txt

Step 1 - Executed with cmd.exe, this command works fine :

  • Download the file "file_01.pdf" in the current directory.
  • Create a log file named wgetlog.txt in the current directory.

Step 2 - Executed within a powershell script, this command doesn't work as expected :

  • Download the file "file_01.pdf" in the current directory
  • Rename it as wgetlog.txt.

WGET is a program with case sensitive parameters :

  • -o means "create a log file with a specified name"
  • -O means "save the downloaded file with a specified name"

So, I suspect that the script executed with powershell don't take in charge the "case sensitive" functionality and execute the command line "after an upper case conversion".

Is there a way to apply the command with case sensitive or a workaround to solve this problem ?



Solution 1:[1]

For some inexplicable reason, the Windows PowerShell team decided to make wget the alias name of the Invoke-WebRequest cmdlet.

Invoke-WebRequest does not even try to be compatible with wget.

To make sure PowerShell uses the actual wget program, use its full name, wget.exe

wget.exe https://domain-name/file_01.pdf -o wgetlog.txt

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1