-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathinstaller.ps1
More file actions
26 lines (20 loc) · 914 Bytes
/
installer.ps1
File metadata and controls
26 lines (20 loc) · 914 Bytes
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
# irm https://pkgx.sh | iex
$ErrorActionPreference = "Stop"
# Determine install location for the current user
$installDir = "$env:LOCALAPPDATA\pkgx"
# Create directory if it doesn't exist
if (!(Test-Path $installDir)) {
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
}
# Download and extract
$zipUrl = "https://pkgx.sh/Windows/x86_64.zip"
$zipFile = "$env:TEMP\pkgx.zip"
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile
Expand-Archive -Path $zipFile -DestinationPath $installDir -Force
Remove-Item $zipFile
# Ensure user's PATH is updated
$envPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::User)
if ($envPath -notlike "*$installDir*") {
[System.Environment]::SetEnvironmentVariable("Path", "$envPath;$installDir", [System.EnvironmentVariableTarget]::User)
}
Write-Host "pkgx installed successfully! Restart your terminal to use it."