Get-ChocolateyWebFile

Get-ChocolateyWebFile

Get-ChocolateyWebFile

Downloads a file from the internet.

Syntax

Get-ChocolateyWebFile `
  -PackageName <String> `
  -FileFullPath <String> `
  [-Url <String>] `
  [-Url64bit <String>] `
  [-Checksum <String>] `
  [-ChecksumType <String>] `
  [-Checksum64 <String>] `
  [-ChecksumType64 <String>] `
  [-Options <Hashtable>] `
  [-GetOriginalFileName] `
  [-ForceDownload] `
  [-IgnoredArguments <Object[]>] [<CommonParameters>]

Description

This will download a file from a url, tracking with a progress bar. It returns the filepath to the downloaded file when it is complete.

Notes

Chocolatey works best when the packages contain the software it is managing and doesn’t require downloads. However most software in the Windows world requires redistribution rights and when sharing packages publicly (like on the community feed), maintainers may not have those aforementioned rights. Chocolatey understands how to work with that, hence this function. You are not subject to this limitation with internal packages.

Aliases

None

Examples

EXAMPLE 1

Get-ChocolateyWebFile '__NAME__' 'C:\somepath\somename.exe' 'URL' '64BIT_URL_DELETE_IF_NO_64BIT'

EXAMPLE 2


# Download from an HTTPS location
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Get-ChocolateyWebFile -PackageName 'bob' -FileFullPath "$toolsDir\bob.exe" -Url 'https://somewhere/bob.exe'

EXAMPLE 3


# Download from FTP
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
Get-ChocolateyWebFile -PackageName 'bob' -FileFullPath "$toolsDir\bob.exe" -Url 'ftp://somewhere/bob.exe'

EXAMPLE 4


# Download from a file share
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
Get-ChocolateyWebFile -PackageName 'bob' -FileFullPath "$toolsDir\bob.exe" -Url 'file:///\\fileshare\location\bob.exe'

EXAMPLE 5


$options =
@{
  Headers = @{
    Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
    'Accept-Charset' = 'ISO-8859-1,utf-8;q=0.7,*;q=0.3';
    'Accept-Language' = 'en-GB,en-US;q=0.8,en;q=0.6';
    Cookie = 'requiredinfo=info';
    Referer = 'https://somelocation.com/';
  }
}

Get-ChocolateyWebFile -PackageName 'package' -FileFullPath "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\thefile.exe" -Url 'https://somelocation.com/thefile.exe' -Options $options

Inputs

None

Outputs

None

Parameters

-PackageName <String>

PropertyValue
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false

-FileFullPath <String>

PropertyValue
Aliases
Required?true
Position?2
Default Value
Accept Pipeline Input?false

-Url [<String>]

PropertyValue
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?false

-Url64bit [<String>]

PropertyValue
Aliasesurl64
Required?false
Position?4
Default Value
Accept Pipeline Input?false

-Checksum [<String>]

PropertyValue
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false

-ChecksumType [<String>]

PropertyValue
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false

-Checksum64 [<String>]

PropertyValue
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false

-ChecksumType64 [<String>]

PropertyValue
Aliases
Required?false
Position?named
Default Value$checksumType
Accept Pipeline Input?false

-Options [<Hashtable>]

PropertyValue
Aliases
Required?false
Position?named
Default Value@{Headers = @{} }
Accept Pipeline Input?false

-GetOriginalFileName

PropertyValue
Aliases
Required?false
Position?named
Default ValueFalse
Accept Pipeline Input?false

-ForceDownload

PropertyValue
Aliases
Required?false
Position?named
Default ValueFalse
Accept Pipeline Input?false

-IgnoredArguments [<Object[]>]

PropertyValue
Aliases
Required?false
Position?named
Default Value
Accept Pipeline Input?false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters http://go.microsoft.com/fwlink/p/?LinkID=113216 .

Function Reference

:choco-info: NOTE

This documentation has been automatically generated from Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force; Get-Help Get-ChocolateyWebFile -Full.

View the source for Get-ChocolateyWebFile