-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSetupInconsolataFont.ps1
48 lines (38 loc) · 1.29 KB
/
SetupInconsolataFont.ps1
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
48
<#
Author:
Version:
Version History:
Purpose: Download and setup Inconsolata font(s)
.LINK
https://twitter.com/fearthecowboy/status/595237159574970368?refsrc=email&s=11
#>
# Download
$Url = 'http://levien.com/type/myfonts/Inconsolata.otf'
$Path = "$HOME\Downloads\Inconsolata.otf"
#$Username = ''
#$Password = ''
# 1st: check if download path exists already, if so ... what should we do?
if (test-path $Path) {
Write-Warning "Download destination $Path already exists."
} else {
Write-Output -InputObject "Downloading $url to $path";
# ? Enhance progress display?
$WebClient = New-Object System.Net.WebClient
#$WebClient.Credentials = New-Object System.Net.Networkcredential($null, $null); # ($Username, $Password)
$WebClient.DownloadFile( "$url", "$path" )
}
# Confirm expected file is at target $path
try {
$download = Test-Path -Path $Path -PathType Leaf
}
catch {
Write-Warning "Unable to confirm $URL was downloaded to $Path"
break;
}
Write-Debug $download -Debug;
if ($download -ne $null) {
# If we think the file downloaded ok, let's try it out
# * RFE * : add check for .exe extension; any other security considerations?
Write-Output -InputObject "Starting installer: $Path";
& $Path; # no silent / quiet install options are apparently available.
}