mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-25 08:09:17 +01:00
Improved download.ps1
This commit is contained in:
parent
6fdc479d96
commit
8313e34cc1
@ -8,21 +8,14 @@
|
|||||||
|
|
||||||
param($URL = "")
|
param($URL = "")
|
||||||
|
|
||||||
if ($URL -eq "" ) {
|
|
||||||
$URL = read-host "Enter URL to download"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
& wget --version
|
& wget --version
|
||||||
} catch {
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||||
write-error "Can't execute 'wget' - make sure wget is installed and available"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||||
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
|
||||||
|
|
||||||
write-host -foregroundColor green "Done."
|
write-host -foregroundColor green "OK - downloaded from $URL"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user