-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathwget.ps1
More file actions
47 lines (39 loc) · 1.16 KB
/
wget.ps1
File metadata and controls
47 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright (C) 2020-2021 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
<#
.SYNOPSIS
Downloads a file if it doesn't exist.
.PARAMETER url
URL of the file to be download downloaded.
.PARAMETER o
The value '-O'
.PARAMETER output
The output file to downloading into.
.EXAMPLE
Make the C:\random\test123 file
PS C:\> wget https://example.com/file.zip C:\random\file.zip
.NOTES
Author: SymbiFlow Authors
License: ISC
#>
$url=$args[0]
$o=$args[1]
$output=$args[2]
# Download with HTTPS
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
$ProgressPreference = 'SilentlyContinue' # Faster download with Invoke-WebRequest
$outdir = Split-Path -Path $output
New-Item -Path $outdir -ItemType directory -Force
If(!(test-path $output)) {
Write-Host "'$output' is missing."
Invoke-WebRequest $url -OutFile $output
Write-Host "'$output' download."
} else {
Write-Host "'$output' already exists."
}