Skip to content

Instantly share code, notes, and snippets.

@BrunoMoraes-Z
Last active May 21, 2025 14:20
Show Gist options
  • Save BrunoMoraes-Z/e1020424619146b66abe252da0f88c36 to your computer and use it in GitHub Desktop.
Save BrunoMoraes-Z/e1020424619146b66abe252da0f88c36 to your computer and use it in GitHub Desktop.

Dependencies Installer 🚀

English

📌 Prerequisites

  • Run PowerShell as Administrator
  • ✅ Internet connection

⚙️ Execution

You have three options to run:

  • Combined: download and install in one go:

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; iex (Invoke-WebRequest 'https://gist.githubusercontent.com/BrunoMoraes-Z/e1020424619146b66abe252da0f88c36/raw/dependencies-installer.ps1' -UseBasicParsing).Content
  • Download only (no installation):

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; iex (Invoke-WebRequest 'https://gist.githubusercontent.com/BrunoMoraes-Z/e1020424619146b66abe252da0f88c36/raw/dependencies-downloader.ps1' -UseBasicParsing).Content
  • Install only (uses previously downloaded installers in current folder):

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; iex (Invoke-WebRequest 'https://gist.githubusercontent.com/BrunoMoraes-Z/e1020424619146b66abe252da0f88c36/raw/installer.ps1' -UseBasicParsing).Content

🔍 What the scripts do

  • dependencies-downloader.ps1

    • 🎯 Downloads Python, Node.js, Java, Git, Visual C++ Redistributables and VSCode installers into the current directory.
    • 🛠️ Interactive menu to select which dependencies to download only.
    • 🌐 Uses BITS with fallback to Invoke-WebRequest for robust, resumable downloads.
  • installer.ps1

    • 🎯 Installs any of the above installer files found in the current directory.
    • 🔍 Automatically detects Python, Node.js, Java, Git, VC++ Redistributables and VSCode installers by filename patterns.
    • 🤖 Runs each installer silently with appropriate arguments.

⚠️ Notes

  • The execution policy is changed only for the current session, no global impact.
  • Run dependencies-downloader.ps1 first if you need to fetch installers behind a firewall.
  • Then run installer.ps1 to perform the silent installations.

Português

📌 Pré-requisitos

  • Execute o PowerShell como Administrador
  • ✅ Conexão com a Internet

⚙️ Execução

Você tem três opções para executar:

  • Combinado: baixar e instalar em uma única execução:

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; iex (Invoke-WebRequest 'https://gist.githubusercontent.com/BrunoMoraes-Z/e1020424619146b66abe252da0f88c36/raw/dependencies-installer.ps1' -UseBasicParsing).Content
  • Apenas download (sem instalação):

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; iex (Invoke-WebRequest 'https://gist.githubusercontent.com/BrunoMoraes-Z/e1020424619146b66abe252da0f88c36/raw/dependencies-downloader.ps1' -UseBasicParsing).Content
  • Apenas instalação (usa instaladores já baixados na pasta atual):

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; iex (Invoke-WebRequest 'https://gist.githubusercontent.com/BrunoMoraes-Z/e1020424619146b66abe252da0f88c36/raw/installer.ps1' -UseBasicParsing).Content

🔍 O que os scripts fazem

  • dependencies-downloader.ps1

    • 🎯 Baixa os instaladores de Python, Node.js, Java, Git, Visual C++ Redistributables e VSCode na pasta atual.
    • 🛠️ Menu interativo para selecionar quais dependências baixar somente.
    • 🌐 Utiliza BITS com fallback para Invoke-WebRequest para downloads confiáveis e com resume automático.
  • installer.ps1

    • 🎯 Instala qualquer um dos instaladores acima encontrados na pasta atual.
    • 🔍 Detecta automaticamente instaladores de Python, Node.js, Java, Git, VC++ Redistributables e VSCode por padrão de nome de arquivo.
    • 🤖 Executa cada instalador silenciosamente com os parâmetros apropriados.

⚠️ Observações

  • A política de execução é alterada apenas para a sessão atual, sem impacto global.
  • Execute dependencies-downloader.ps1 primeiro em ambientes com restrição de download.
  • Em seguida, execute installer.ps1 para realizar as instalações silenciosas.
Clear-Host
function Show-MultiSelectMenu {
[CmdletBinding()]
param(
[Parameter(Mandatory)][string[]]$Options,
[string]$Prompt = 'Use Up/Down to navigate, Space to toggle, Enter to confirm'
)
$selected = New-Object bool[] $Options.Count; $current=0; $done=$false
[Console]::CursorVisible=$false
try {
while (-not $done) {
Clear-Host; Write-Host $Prompt -ForegroundColor Yellow; Write-Host ''
for ($i=0; $i -lt $Options.Count; $i++) {
$marker = if ($i -eq $current) {'>'} else {' '}
$box = if ($selected[$i]) {'[X]'} else {'[ ]'}
Write-Host "$marker $box $($Options[$i])" -ForegroundColor:($(if($i -eq $current){'Cyan'}else{'White'}))
}
$k=[Console]::ReadKey($true)
switch ($k.Key) {
'UpArrow' { if (--$current -lt 0) { $current = $Options.Count -1 } }
'DownArrow' { if (++$current -ge $Options.Count) { $current = 0 } }
'Spacebar' { $selected[$current] = -not $selected[$current] }
'Enter' { $done = $true }
}
}
} finally { [Console]::CursorVisible=$true; Clear-Host }
$Options | Where-Object { $selected[$Options.IndexOf($_)] }
}
function Show-SingleSelectMenu {
[CmdletBinding()]
param(
[Parameter(Mandatory)][string[]]$Options,
[string]$Prompt = 'Use Up/Down to navigate, Enter to select'
)
$current=0; $done=$false; [Console]::CursorVisible=$false
try {
while(-not $done) {
Clear-Host; Write-Host $Prompt -ForegroundColor Yellow; Write-Host ''
for ($i=0; $i -lt $Options.Count; $i++) {
$marker = if($i -eq $current){'>'}else{' '}
Write-Host "$marker $($Options[$i])" -ForegroundColor:($(if($i -eq $current){'Cyan'}else{'White'}))
}
$k=[Console]::ReadKey($true)
switch($k.Key){ 'UpArrow'{if(--$current -lt 0){$current=$Options.Count-1}} 'DownArrow'{ if(++$current -ge $Options.Count){$current=0}} 'Enter'{ $done=$true }}
}
} finally { [Console]::CursorVisible=$true; Clear-Host }
$Options[$current]
}
function Select-PythonVersion {
$data = Invoke-RestMethod 'https://www.python.org/ftp/python/index-windows.json' -UseBasicParsing
$stable = $data.versions | Where-Object { $_.'sort-version' -match '^[0-9]+(\.[0-9]+)*$' }
$latest = $stable[0].'sort-version'; $lm = ($latest -split '\.')[0..1] -join '.'
$seen = @(); $opts = @("$latest [LTS]")
foreach($e in $stable){ $v=$e.'sort-version'; $m=($v -split '\.')[0..1]-join'.'; if($m -eq $lm){continue}; if($seen -notcontains $m){$seen+=$m;$opts+=$v}; if($seen.Count -ge 5){break}}
Show-SingleSelectMenu -Options $opts -Prompt 'Select Python version to download'
}
function Select-NodeVersion {
$vers = Invoke-RestMethod 'https://nodejs.org/dist/index.json' -UseBasicParsing
$latest = ($vers | Where-Object { $_.lts } | Select-Object -First 1).version.TrimStart('v'); $lm=$latest.Split('.')[0]
$seen=@();$opts=@("v$latest [LTS]")
foreach($i in $vers){ $v=$i.version.TrimStart('v'); $maj=$v.Split('.')[0]; if($maj -eq $lm){continue}; if($seen -notcontains $maj){$seen+=$maj;$opts+="v$v"}; if($seen.Count -ge 5){break}}
Show-SingleSelectMenu -Options $opts -Prompt 'Select Node.js version to download'
}
function Select-JavaVersion { Show-SingleSelectMenu -Options @('Java 10','Java 14','Java 17','Java 20','Java 23') -Prompt 'Select Java version to download' }
$all = @('Python','Node.js','Java','Git','VCRedist','VSCode')
$sel = Show-MultiSelectMenu -Options $all
if(-not $sel){ Write-Host 'None selected.'; exit }
$versMap=@{}
if($sel -contains 'Python'){ $raw=Select-PythonVersion; $versMap['Python']=$raw -replace ' \[LTS\]$','' }
if($sel -contains 'Node.js'){ $raw=Select-NodeVersion; $versMap['Node.js']=$raw -replace '^v','' -replace ' \[LTS\]$','' }
if($sel -contains 'Java'){ $versMap['Java']=Select-JavaVersion }
foreach($opt in $sel){
switch($opt){
'Python' {
$v=$versMap['Python']; $sfx=if([Environment]::Is64BitOS){'-amd64'}else{''}
$fn="python-$v$sfx.exe"; $url="https://www.python.org/ftp/python/$v/$fn"
}
'Node.js' {
$v=$versMap['Node.js']; $fn="node-v$v-x64.msi"; $url="https://nodejs.org/dist/v$v/$fn"
}
'Java' {
switch($versMap['Java']){
'Java 10'{ $url='https://download.java.net/openjdk/jdk10/ri/jdk-10+44_windows-x64_bin_ri.tar.gz' }
'Java 14'{ $url='https://download.java.net/openjdk/jdk14/ri/openjdk-14+36_windows-x64_bin.zip' }
'Java 17'{ $url='https://download.java.net/openjdk/jdk17.0.0.1/ri/openjdk-17.0.0.1+2_windows-x64_bin.zip' }
'Java 20'{ $url='https://download.java.net/openjdk/jdk20/ri/openjdk-20+36_windows-x64_bin.zip' }
'Java 23'{ $url='https://download.java.net/openjdk/jdk23/ri/openjdk-23+37_windows-x64_bin.zip' }
}
$fn=Split-Path $url -Leaf
}
'Git' {
$release = Invoke-RestMethod 'https://api.github.com/repos/git-for-windows/git/releases/latest' -Headers @{ 'User-Agent' = 'PS' }
$asset = $release.assets |
Where-Object { $_.name -match 'Git-.*-64-bit\.exe$' } |
Select-Object -First 1
if (-not $asset) {
Write-Error 'Não achei o instalador .exe 64-bit do Git.'
break
}
$url = $asset.browser_download_url
$fn = $asset.name
}
'VCRedist'{
$url='https://aka.ms/vs/17/release/vc_redist.x86.exe'
$fn='vc_redist.x86.exe'
if([Environment]::Is64BitOS) {
Write-Host 'Will also fetch x64'
}
}
'VSCode' {
$url='https://code.visualstudio.com/sha/download?build=stable&os=win32-x64'
$fn='VSCodeSetup-x64.exe'
}
}
Write-Host "Downloading $fn..." -NoNewline
Invoke-WebRequest -Uri $url -OutFile (Join-Path (Get-Location) $fn) -UseBasicParsing
if($opt -eq 'VCRedist' -and [Environment]::Is64BitOS) {
$url='https://aka.ms/vs/17/release/vc_redist.x64.exe'
$fn='vc_redist.x64.exe'
Write-Host "Downloading $fn..." -NoNewline
Invoke-WebRequest -Uri $url -OutFile (Join-Path (Get-Location) $fn) -UseBasicParsing
}
Write-Host ' OK'
}
Clear-Host
function Show-MultiSelectMenu {
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string[]]$Options,
[string]$Prompt = 'Use Up/Down to navigate, Space to toggle, Enter to confirm'
)
$selected = New-Object bool[] $Options.Count
$current = 0
$done = $false
[Console]::CursorVisible = $false
try {
while (-not $done) {
Clear-Host
Write-Host $Prompt -ForegroundColor Yellow
Write-Host ''
for ($i = 0; $i -lt $Options.Count; $i++) {
$marker = if ($i -eq $current) { '>' } else { ' ' }
$checkbox = if ($selected[$i]) { '[X]' } else { '[ ]' }
$line = "{0} {1} {2}" -f $marker, $checkbox, $Options[$i]
if ($i -eq $current) {
Write-Host $line -ForegroundColor Cyan
} else {
Write-Host $line
}
}
$key = [Console]::ReadKey($true)
switch ($key.Key) {
'UpArrow' { if (--$current -lt 0) { $current = $Options.Count - 1 } }
'DownArrow' { if (++$current -ge $Options.Count) { $current = 0 } }
'Spacebar' { $selected[$current] = -not $selected[$current] }
'Enter' { $done = $true }
}
}
} finally {
[Console]::CursorVisible = $true
Clear-Host
}
$result = @()
for ($i = 0; $i -lt $Options.Count; $i++) {
if ($selected[$i]) { $result += $Options[$i] }
}
return $result
}
function Show-SingleSelectMenu {
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string[]]$Options,
[string]$Prompt = 'Use Up/Down to navigate, Enter to select'
)
$current = 0
$done = $false
[Console]::CursorVisible = $false
try {
while (-not $done) {
Clear-Host
Write-Host $Prompt -ForegroundColor Yellow
Write-Host ''
for ($i = 0; $i -lt $Options.Count; $i++) {
$marker = if ($i -eq $current) { '>' } else { ' ' }
$line = "{0} {1}" -f $marker, $Options[$i]
if ($i -eq $current) {
Write-Host $line -ForegroundColor Cyan
} else {
Write-Host $line
}
}
$key = [Console]::ReadKey($true)
switch ($key.Key) {
'UpArrow' { if (--$current -lt 0) { $current = $Options.Count - 1 } }
'DownArrow' { if (++$current -ge $Options.Count) { $current = 0 } }
'Enter' { $done = $true }
}
}
} finally {
[Console]::CursorVisible = $true
Clear-Host
}
return $Options[$current]
}
function Select-PythonVersion {
$data = Invoke-RestMethod -Uri 'https://www.python.org/ftp/python/index-windows.json' -UseBasicParsing
$stable = $data.versions | Where-Object { $_.'sort-version' -match '^[0-9]+(\.[0-9]+)*$' }
$latest = $stable[0].'sort-version'
$lm = ($latest -split '\.')[0..1] -join '.'
$seen = @()
$opts = @("$latest [LTS]")
foreach ($e in $stable) {
$v = $e.'sort-version'
$minor = ($v -split '\.')[0..1] -join '.'
if ($minor -eq $lm) { continue }
if ($seen -notcontains $minor) {
$seen += $minor
$opts += $v
}
if ($seen.Count -ge 5) { break }
}
return Show-SingleSelectMenu -Options $opts -Prompt 'Select Python version to install'
}
function Select-NodeVersion {
$vers = Invoke-RestMethod -Uri 'https://nodejs.org/dist/index.json' -UseBasicParsing
$latest = ($vers | Where-Object { $_.lts } | Select-Object -First 1).version.TrimStart('v')
$lm = $latest.Split('.')[0]
$seen = @()
$opts = @("v$latest [LTS]")
foreach ($i in $vers) {
$v = $i.version.TrimStart('v')
$maj = $v.Split('.')[0]
if ($maj -eq $lm) { continue }
if ($seen -notcontains $maj) {
$seen += $maj
$opts += "v$v"
}
if ($seen.Count -ge 5) { break }
}
return Show-SingleSelectMenu -Options $opts -Prompt 'Select Node.js version to install'
}
function Select-JavaVersion {
$opts = @('Java 10','Java 14','Java 17','Java 20','Java 23')
return Show-SingleSelectMenu -Options $opts -Prompt 'Select Java version to install'
}
function Install-Python {
param([string]$Version)
$Version = $Version -replace ' \[LTS\]$',''
Write-Host "Installing Python $Version..." -ForegroundColor Green
$suffix = if ([Environment]::Is64BitOperatingSystem) { '-amd64' } else { '' }
$fileName = "python-$Version$suffix.exe"
$url = "https://www.python.org/ftp/python/$Version/$fileName"
$outPath = "$env:TEMP\$fileName"
Write-Host "Downloading $fileName..." -NoNewline
Invoke-WebRequest -Uri $url -OutFile $outPath -UseBasicParsing
Write-Host ' OK'
Write-Host "Running installer..." -NoNewline
Start-Process -FilePath $outPath -ArgumentList '/passive InstallAllUsers=1 PrependPath=1' -Wait
Write-Host ' OK'
Remove-Item $outPath -Force
}
function Install-NodeJs {
param([string]$Version)
$Version = $Version -replace ' \[LTS\]$',''
Write-Host "Installing Node.js $Version..." -ForegroundColor Green
$installer = "$env:TEMP\node-v$Version-x64.msi"
$url = "https://nodejs.org/dist/$Version/node-$Version-x64.msi"
Write-Host "Downloading Node.js $Version..." -NoNewline
Invoke-WebRequest -Uri $url -OutFile $installer -UseBasicParsing
Write-Host ' OK'
Write-Host "Running installer..." -NoNewline
Start-Process -FilePath 'msiexec.exe' -ArgumentList "/i `"$installer`" /passive /qr /norestart" -Wait
Write-Host ' OK'
Remove-Item $installer -Force
}
function Install-Java {
param([string]$Version)
$Version = $Version -replace ' \[LTS\]$',''
Write-Host "Installing $Version..." -ForegroundColor Green
switch ($Version) {
'Java 10' { $url = 'https://download.java.net/openjdk/jdk10/ri/jdk-10+44_windows-x64_bin_ri.tar.gz' }
'Java 14' { $url = 'https://download.java.net/openjdk/jdk14/ri/openjdk-14+36_windows-x64_bin.zip' }
'Java 17' { $url = 'https://download.java.net/openjdk/jdk17.0.0.1/ri/openjdk-17.0.0.1+2_windows-x64_bin.zip' }
'Java 20' { $url = 'https://download.java.net/openjdk/jdk20/ri/openjdk-20+36_windows-x64_bin.zip' }
'Java 23' { $url = 'https://download.java.net/openjdk/jdk23/ri/openjdk-23+37_windows-x64_bin.zip' }
}
$fileName = Split-Path $url -Leaf
$outPath = "$env:TEMP\$fileName"
Write-Host "Downloading $fileName..." -NoNewline
Invoke-WebRequest -Uri $url -OutFile $outPath -UseBasicParsing
Write-Host ' OK'
$installDir = "C:\Program Files\Java\$Version"
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
Write-Host "Extracting..." -NoNewline
if ($fileName -match '\.zip$') {
Expand-Archive -Path $outPath -DestinationPath $installDir -Force
} else {
tar -xzf $outPath -C $installDir
}
$subs = Get-ChildItem -Directory -Path $installDir
if ($subs.Count -eq 1) {
$inner = $subs[0].FullName
Get-ChildItem -Path $inner -Force | Move-Item -Destination $installDir -Force
Remove-Item -Path $inner -Recurse -Force
}
Write-Host ' OK'
Remove-Item $outPath -Force
Write-Host "Updating PATH..." -NoNewline
& setx PATH "$($env:Path);$installDir\bin" -m | Out-Null
Write-Host ' OK'
}
function Install-Git {
Write-Host 'Installing Git...' -ForegroundColor Green
$rel = Invoke-RestMethod -Uri 'https://api.github.com/repos/git-for-windows/git/releases/latest' -Headers @{ 'User-Agent' = 'PowerShell' }
$asset = $rel.assets | Where-Object { $_.name -match '64-bit\.exe$' } | Select-Object -First 1
$installer = "$env:TEMP\$($asset.name)"
Write-Host "Downloading Git..." -NoNewline
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $installer -UseBasicParsing
Write-Host ' OK'
Write-Host "Running installer..." -NoNewline
Start-Process -FilePath $installer -ArgumentList '/SP','/SUPPRESSMSGBOXES','/SILENT','/NORESTART' -Wait
Write-Host ' OK'
Remove-Item $installer -Force
}
function Install-VCRedist {
Write-Host 'Installing Visual C++ Redistributables...' -ForegroundColor Green
$temp = $env:TEMP
$x86 = Join-Path $temp 'vc_redist.x86.exe'
$x64 = Join-Path $temp 'vc_redist.x64.exe'
Invoke-WebRequest 'https://aka.ms/vs/17/release/vc_redist.x86.exe' -OutFile $x86 -UseBasicParsing
Start-Process -FilePath $x86 -ArgumentList '/install','/passive','/norestart' -Wait
if ([Environment]::Is64BitOperatingSystem) {
Invoke-WebRequest 'https://aka.ms/vs/17/release/vc_redist.x64.exe' -OutFile $x64 -UseBasicParsing
Start-Process -FilePath $x64 -ArgumentList '/install','/passive','/norestart' -Wait
Remove-Item $x64 -Force
}
Remove-Item $x86 -Force
}
function Install-VSCode {
Write-Host 'Installing Visual Studio Code...' -ForegroundColor Green
$out = "$env:TEMP\VSCodeSetup-x64.exe"
Invoke-WebRequest 'https://code.visualstudio.com/sha/download?build=stable&os=win32-x64' -OutFile $out -UseBasicParsing
Start-Process -FilePath $out -ArgumentList '/SILENT','/MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath' -Wait
Remove-Item $out -Force
}
$allOpts = @(
'Install Python',
'Install Node.js',
'Install Java',
'Install Git',
'Install Visual C++ Redistributables',
'Install Visual Studio Code'
)
$selected = Show-MultiSelectMenu -Options $allOpts
if (-not $selected) {
Write-Host 'No option selected.' -ForegroundColor Red
exit 1
}
$versMap = @{}
if ($selected -contains 'Install Python') { $versMap['Install Python'] = Select-PythonVersion }
if ($selected -contains 'Install Node.js') { $versMap['Install Node.js'] = Select-NodeVersion }
if ($selected -contains 'Install Java') { $versMap['Install Java'] = Select-JavaVersion }
foreach ($opt in $selected) {
switch ($opt) {
'Install Python' { Install-Python -Version $versMap[$opt] }
'Install Node.js' { Install-NodeJs -Version $versMap[$opt] }
'Install Java' { Install-Java -Version $versMap[$opt] }
'Install Git' { Install-Git }
'Install Visual C++ Redistributables' { Install-VCRedist }
'Install Visual Studio Code' { Install-VSCode }
}
}
Write-Host "`nAll installations complete." -ForegroundColor Green
Clear-Host
$files = Get-ChildItem -File
function Install-Files {
foreach ($f in $files) {
switch -Wildcard ($f.Name) {
'python-*-amd64.exe' {
Write-Host "Installing $($f.Name)..."
Start-Process $f.FullName '/passive InstallAllUsers=1 PrependPath=1' -Wait
}
'python-*.exe' {
Write-Host "Installing $($f.Name)..."
Start-Process $f.FullName '/passive InstallAllUsers=1 PrependPath=1' -Wait
}
'node-v*-x64.msi' {
Write-Host "Installing Node.js $($f.Name)..."
Start-Process msiexec.exe "/i `"$($f.FullName)`" /passive /qr /norestart" -Wait
}
'jdk*-bin_ri.tar.gz' {
Extract-And-RegisterJava $f.FullName
}
'openjdk-*-bin.zip' {
Extract-And-RegisterJava $f.FullName
}
'vc_redist.x86.exe' {
Write-Host 'Installing VC++ x86...'
Start-Process $f.FullName '/install /passive /norestart' -Wait
}
'vc_redist.x64.exe' {
Write-Host 'Installing VC++ x64...'
Start-Process $f.FullName '/install /passive /norestart' -Wait
}
'VSCodeSetup-*.exe' {
Write-Host 'Installing VSCode...'
Start-Process $f.FullName '/SILENT /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath' -Wait
}
'Git-*-64-bit.exe' {
Write-Host 'Installing Git...'
Start-Process $f.FullName '/SP /SUPPRESSMSGBOXES /SILENT /NORESTART' -Wait
}
}
}
}
function Extract-And-RegisterJava {
param($archive)
$installDir = "C:\Program Files\Java\$(Split-Path $archive -LeafBase)"
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
if ($archive -match '\.zip$') {
Expand-Archive $archive -DestinationPath $installDir -Force
}
else {
tar -xzf $archive -C $installDir
}
$subs = Get-ChildItem -Directory -Path $installDir
if ($subs.Count -eq 1) {
Move-Item "$installDir\*" $installDir
Remove-Item -Recurse "$installDir\$($subs[0].Name)" -Force
}
& setx PATH "$($env:Path);$installDir\bin" -m | Out-Null
}
Install-Files
Write-Host "`nAll detected installers have been processed." -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment