Execute the following command in powershell.

wget -r --no-parent -w 1 -l 1 --restrict-file-names = nocontrol https://gihyo.jp/db/

I get the following error:

Invoke-WebRequest: Parameter'WebSession'cannot be bound."1"value from"System.Int32"type to"Microsoft.PowerShell.Commands.WebRequestSession"type
Cannot convert.
Occurrence line: 1 character: 24
+ wget -r --no-parent -w 1 -l 1 --restrict-file-names = nocontrol https:/...
+ ~
+ CategoryInfo: InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId: CannotConvertArgumentNoMessage, Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Please tell me what to do. Thank you.

  • Answer # 1

    The command and parameter specification combination you are using is incorrect.

    The command listed in the question seems to be intended to use thewgetcommand as described on the following page.


    [wget] command-download file by specifying URL: Linux basic command Tips (24)[email protected]

    However, Windows does not normally have thewgetcommand equivalent to Linux.

    On PowerShell,wgetis defined as an alias for the Invoke-WebRequest cmdlet, and this is what was actually called.
    And the parameter specification ofInvoke-WebRequestcmdlet is different from the Linuxwgetcommand, so an error occurs.

    I think there are the following methods as countermeasures (examples only).

    Specify parameters for PowerShellInvoke-WebRequestcmdlet

    Install and use a program to reproduce wget on Windows

    Usewgetin Windows Subsystem for Linux

    For more than this, please clarify what you want to use and what you want to do and create a separate question.

    Reference: Confirm alias

    It is better to think of commands displayed on PowerShell that are not inVerb-Nounformat and have no extension as aliases.

    You can see the actual definition by using the

    Get-Alias ​​cmdlet.

    Get-Alias ​​-Name wget
    CommandType Name Version Source
    ----------- ---- ------- ------
    Alias ​​wget->Invoke-WebRequest