Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Invoke-WebRequest -OutLeaf #20010

Copy link
Copy link
@dkaszews

Description

@dkaszews
Issue body actions

Summary of the new feature / enhancement

I would like an ability to download a file with Invoke-WebRequest without explicitly providing its name, same as with curl -O. The filename should be deduced from the uri, equivalent to -Uri $Uri -OutFile (Split-Path $Uri). If the uri contains query parameters, they are either discarded (test.txt?param=value results in test.txt), or an error should be given.

Motivating example can be seen in Invoke-WebRequest example #8, the filename is typed twice for every file - once in Uri and once in OutFile.

Additionally, I think that -OutLeaf without -PassThru should return the full resolved path to the downloaded file, so that it can be stored or piped into Start-Process or Invoke-Command for immediate execution (useful for e.g. installers).

Similar proposals were made in:

I agree with the latter, that -OutDirectory could be an alternative API, so that you can get Invoke-WebRequest -OutLeaf with Invoke-WebRequest -OutDirectory ., while also allowing to download files with implicit filename to a different directory.

Opens:

  • Should the filename be url-decoded? I.e. should Invoke-WebRequest example.com/file%20with%space.txt -OutLeaf result in file%20with%20space.txt or file with space.txt? I would say latter, curl says former.

Proposed technical implementation details (optional)

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.