-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.ps1
37 lines (31 loc) · 1.09 KB
/
install.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
# Download the Ultimate AW User Guide from GitHub and backup the current default.awh
[CmdletBinding()]
Param
(
[string] $AWHelpPath = "C:\Users\$env:username\AppData\Local\ActiveWorlds 3D\Help\",
[string] $Default = "default.awh",
[Switch] $Remote = $false,
[Switch] $SkipBackup = $false
)
if($SkipBackup)
{
Write-Debug "Skipping backup"
}
else
{
# Backup existing default.awh file in the same directory
$timestamp = (Get-Date -f yyyyMMdd-HHmm)
Write-Debug "Backing up $AWHelpPath$Default to $($AWHelpPath)backup-$($timestamp).awh"
# Create a backup of the existing help file.
Move-Item "$AWHelpPath$Default" $AWHelpPath"backup-"$timestamp".awh" -Force
}
if($Remote)
{
Write-Debug "Copying remote to $($AWHelpPath)default.awh"
(Invoke-WebRequest -URI "https://raw.github.com/AnthonyNeace/AWUserGuideUtilities/main/user-guides/ultimateawuserguide.awh").Content | Out-File "$AWHelpPath$Default" -Encoding "UTF8"
}
else
{
Write-Debug "Copying to $($AWHelpPath)default.awh"
Copy-Item ".\user-guides\ultimateawuserguide.awh" "$($AWHelpPath)default.awh" -Force
}