Compare commits

..

2 Commits

Author SHA1 Message Date
Windneiro d10aab4c64 .. 2026-04-14 10:02:34 +05:00
Windneiro 3e8877fb80 feat: support both comma and space separated selection 2026-04-14 09:37:26 +05:00
1 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# ============================================================ # ============================================================
# Skript ustanovki programm # Skript ustanovki programm
# Zapusk: irm https://git.help-d.ru/helmut/auto-turning/raw/branch/main/setup.ps1 | iex # Zapusk: irm https://git.help-d.ru/helmut/auto-turning/raw/branch/main/setup.ps1 | iex
# ============================================================ # ============================================================
@ -10,7 +10,7 @@ $temp = "$env:TEMP\win_setup"
# ============================================================ # ============================================================
# 1. OTKLYuChENIE ANTIVIRUSA (OBYAZATELNO!) # 1. OTKLYuChENIE ANTIVIRUSA (OBYAZATELNO!)
# ============================================================ # ============================================================
Write-Host "`n[1/4] Antivirus disable..." -ForegroundColor Yellow Write-Host "`n[1/5] Antivirus disable..." -ForegroundColor Yellow
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue
Set-MpPreference -DisableBehaviorMonitoring $true -ErrorAction SilentlyContinue Set-MpPreference -DisableBehaviorMonitoring $true -ErrorAction SilentlyContinue
@ -25,7 +25,7 @@ Write-Host " Antivirus disabled" -ForegroundColor Green
# ============================================================ # ============================================================
# 2. ZAGRUZKA KONFIGA I SPISKA PROGRAMM # 2. ZAGRUZKA KONFIGA I SPISKA PROGRAMM
# ============================================================ # ============================================================
Write-Host "[2/4] Loading config and program list..." -ForegroundColor Yellow Write-Host "[2/5] Loading config and program list..." -ForegroundColor Yellow
Remove-Item $temp -Recurse -Force -ErrorAction SilentlyContinue Remove-Item $temp -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path $temp -Force | Out-Null New-Item -ItemType Directory -Path $temp -Force | Out-Null
@ -76,7 +76,7 @@ $programList = $programList | Sort-Object Name
# ============================================================ # ============================================================
# 3. VYBOR PROGRAMM # 3. VYBOR PROGRAMM
# ============================================================ # ============================================================
Write-Host "[3/4] Program selection..." -ForegroundColor Yellow Write-Host "[3/5] Program selection..." -ForegroundColor Yellow
Write-Host "`nAvailable programs in repo:`n" -ForegroundColor Cyan Write-Host "`nAvailable programs in repo:`n" -ForegroundColor Cyan
@ -94,7 +94,7 @@ foreach ($prog in $programList) {
Write-Host "`n a - ALL programs" -ForegroundColor Green Write-Host "`n a - ALL programs" -ForegroundColor Green
Write-Host " 0 - Cancel`n" -ForegroundColor Gray Write-Host " 0 - Cancel`n" -ForegroundColor Gray
$choice = Read-Host "Select (numbers separated by space, or a)" $choice = Read-Host "Select (1 2 3 or 1,2,3 or a)"
if ($choice -eq "0") { if ($choice -eq "0") {
Write-Host "Canceled" -ForegroundColor Red Write-Host "Canceled" -ForegroundColor Red
@ -105,7 +105,9 @@ $selectedPrograms = @()
if ($choice -eq "a") { if ($choice -eq "a") {
$selectedPrograms = $allPrograms $selectedPrograms = $allPrograms
} else { } else {
foreach ($num in ($choice -split '\s+') | Where-Object { $_ -match '^\d+$' }) { # Поддержка: "1, 2, 3" или "1 2 3" или "1,2,3"
$normalized = $choice -replace ',', ' '
foreach ($num in ($normalized -split '\s+') | Where-Object { $_ -match '^\d+$' }) {
if ($progMap[[int]$num]) { if ($progMap[[int]$num]) {
$selectedPrograms += $progMap[[int]$num] $selectedPrograms += $progMap[[int]$num]
} }
@ -122,7 +124,7 @@ Write-Host "`nSelected: $($selectedPrograms.Count) programs" -ForegroundColor Gr
# ============================================================ # ============================================================
# 4. SKACHIVANIE I USTANOVKA # 4. SKACHIVANIE I USTANOVKA
# ============================================================ # ============================================================
Write-Host "[4/4] Installing programs..." -ForegroundColor Yellow Write-Host "[4/5] Installing programs..." -ForegroundColor Yellow
$installed = @() $installed = @()
$failed = @() $failed = @()
@ -180,7 +182,7 @@ foreach ($prog in $selectedPrograms) {
# ============================================================ # ============================================================
# 5. ChISTKA I VKLYuChENIE ANTIVIRUSA # 5. ChISTKA I VKLYuChENIE ANTIVIRUSA
# ============================================================ # ============================================================
Write-Host "`n[5/4] Cleanup..." -ForegroundColor Yellow Write-Host "`n[5/5] Cleanup..." -ForegroundColor Yellow
Remove-Item $temp -Recurse -Force -ErrorAction SilentlyContinue Remove-Item $temp -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " Temp files deleted" -ForegroundColor Green Write-Host " Temp files deleted" -ForegroundColor Green