-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.ps1
25 lines (20 loc) · 904 Bytes
/
installer.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
# InstallScript.ps1
# Define URL and Installation Path
$scriptUrl = "https://geohopper.net/geohopper.ps1"
$installPath = "C:\Program Files\Geohopper"
$scriptPath = "$installPath\geohopper.ps1"
# Create Installation Directory
New-Item -ItemType Directory -Force -Path $installPath
# Download Geohopper Script
Invoke-WebRequest -Uri $scriptUrl -OutFile $scriptPath
# Add Installation Path to System PATH
$envPath = [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine)
if (-not $envPath.Split(';').Contains($installPath)) {
[System.Environment]::SetEnvironmentVariable("PATH", "$envPath;$installPath", [System.EnvironmentVariableTarget]::Machine)
}
# Create Wrapper Command
$wrapperPath = "$installPath\geohopper.cmd"
@"
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -File "$scriptPath" %*
"@ | Out-File -FilePath $wrapperPath -Encoding ASCII