İki-üç gündür uğraştığım bir .ps1 betiği idi.Bıkmıştım sürekli ayarlardan dosya uzantısını yazılımla ilişkilendirmekten.Yani ihtiyaçtan hasıl oldu.
Nasıl Kullanılır?GIF Ekran Alıntısı (Sistem : Windows11.24H2.7019 x64 Home TR)

KOD İÇERİĞİ :
Kod: Tümünü seç
# ============================================
# TRWE_2012 - UZANTI PROGRAM ATAMA YÖNETİCİSİ
# Tam sürüm güncellenmiş (Seçenek 4 & 5 güvenli)
# ============================================
function AnaMenu {
Clear-Host
Write-Host "=========================UZANTI PROGRAM ATAMA YÖNETİCİSİNE HOŞGELDİNİZ=========================" -ForegroundColor Cyan
Write-Host ""
Write-Host "******************************"
Write-Host "Ana Menü Seçenekleri : "
Write-Host "******************************"
Write-Host ""
Write-Host "1. Birden çok uzantı + Tek Uygulama + Tek ikon"
Write-Host "2. Birden çok uzantı + Birden Çok Uygulama + Birden Çok İkon"
Write-Host "3. GUI ile Tek Uzantı + Uygulama + İkon Seçimi"
Write-Host "4. Seçili Uzantıları Kayıt Defterinden Yedekleme"
Write-Host "5. Yedekten Geri Yükleme"
Write-Host "6. Ana Menüye Geri Dönüş"
Write-Host "0. Betikten çık..."
Write-Host ""
$secim = Read-Host "Lütfen bir seçenek girin"
switch ($secim) {
"1" { CokluUzantiTekUygulamaIkon }
"2" { CokluUzantiCokUygulamaCokIkon }
"3" { GUIIleTekUzantiSecim }
"4" { SecimliYedekleme }
"5" { YedektenGeriYukleme }
"6" { AnaMenu }
"0" { Write-Host "Betik kapatılıyor..."; exit }
default { Write-Host "Geçersiz seçim!"; Start-Sleep -Seconds 2; AnaMenu }
}
}
# ==================================================
# Seçenek 1: Çoklu uzantı + Tek uygulama + Tek ikon
function CokluUzantiTekUygulamaIkon {
Write-Host "`nSeçenek 1 seçildi..." -ForegroundColor Green
$extensions = Read-Host "Uzantıları girin (örn: .TRWE_2012,.MYTXT)"
$extArray = $extensions.Split(",") | ForEach-Object { $_.Trim() }
$appPath = Read-Host "Uygulamanın tam yolunu girin (örn: D:\Program Files\Notepad3\Notepad3.exe)"
if (-Not (Test-Path $appPath)) { Write-Host "Uygulama yolu bulunamadı!"; Pause; AnaMenu }
$iconPath = Read-Host "İkon yolunu girin (örn: $appPath)"
if (-Not (Test-Path $iconPath)) { Write-Host "İkon bulunamadı. Uygulama ikonu kullanılacak."; $iconPath = $appPath }
foreach ($ext in $extArray) {
try {
$extKey = "HKCU:\Software\Classes\$ext"
$className = "$($ext.TrimStart('.'))File"
$classKey = "HKCU:\Software\Classes\$className"
If (-Not (Test-Path $extKey)) { New-Item -Path $extKey -Force | Out-Null }
Set-ItemProperty -Path $extKey -Name "(Default)" -Value $className
If (-Not (Test-Path $classKey)) { New-Item -Path $classKey -Force | Out-Null }
Set-ItemProperty -Path $classKey -Name "(Default)" -Value "$className Belgesi"
$iconKey = Join-Path $classKey "DefaultIcon"
If (-Not (Test-Path $iconKey)) { New-Item -Path $iconKey -Force | Out-Null }
Set-ItemProperty -Path $iconKey -Name "(Default)" -Value "$iconPath,0"
$openKey = Join-Path $classKey "shell\open\command"
If (-Not (Test-Path $openKey)) { New-Item -Path $openKey -Force | Out-Null }
Set-ItemProperty -Path $openKey -Name "(Default)" -Value "`"$appPath`" `"%1`""
Write-Host "$ext uzantısı başarıyla tanıtıldı." -ForegroundColor Green
} catch { Write-Host "Hata: $_" -ForegroundColor Red }
}
Pause
AnaMenu
}
# ==================================================
# Seçenek 2: Çoklu uzantı + Her uzantı için ayrı uygulama + ikon
function CokluUzantiCokUygulamaCokIkon {
Write-Host "`nSeçenek 2 seçildi..." -ForegroundColor Green
$extensions = Read-Host "Uzantıları girin (örn: .TRWE_2012,.MYTXT)"
$extArray = $extensions.Split(",") | ForEach-Object { $_.Trim() }
foreach ($ext in $extArray) {
Write-Host "`n--- $ext uzantısı için ---" -ForegroundColor Cyan
$appPath = Read-Host "Uygulamanın tam yolunu girin (örn: D:\Program Files\Notepad3\Notepad3.exe)"
if (-Not (Test-Path $appPath)) { Write-Host "Uygulama yolu bulunamadı! İşlem atlandı."; continue }
$iconPath = Read-Host "İkon yolunu girin (örn: $appPath)"
if (-Not (Test-Path $iconPath)) { Write-Host "İkon bulunamadı. Uygulama ikonu kullanılacak."; $iconPath = $appPath }
try {
$extKey = "HKCU:\Software\Classes\$ext"
$className = "$($ext.TrimStart('.'))File"
$classKey = "HKCU:\Software\Classes\$className"
If (-Not (Test-Path $extKey)) { New-Item -Path $extKey -Force | Out-Null }
Set-ItemProperty -Path $extKey -Name "(Default)" -Value $className
If (-Not (Test-Path $classKey)) { New-Item -Path $classKey -Force | Out-Null }
Set-ItemProperty -Path $classKey -Name "(Default)" -Value "$className Belgesi"
$iconKey = Join-Path $classKey "DefaultIcon"
If (-Not (Test-Path $iconKey)) { New-Item -Path $iconKey -Force | Out-Null }
Set-ItemProperty -Path $iconKey -Name "(Default)" -Value "$iconPath,0"
$openKey = Join-Path $classKey "shell\open\command"
If (-Not (Test-Path $openKey)) { New-Item -Path $openKey -Force | Out-Null }
Set-ItemProperty -Path $openKey -Name "(Default)" -Value "`"$appPath`" `"%1`""
Write-Host "$ext uzantısı başarıyla tanıtıldı." -ForegroundColor Green
} catch { Write-Host "Hata: $_" -ForegroundColor Red }
}
Pause
AnaMenu
}
# ==================================================
# Seçenek 3: GUI ile Tek Uzantı + Uygulama + İkon
function GUIIleTekUzantiSecim {
Add-Type -AssemblyName System.Windows.Forms
Write-Host "`nLütfen belirlemek istediğiniz uzantıyı yazın (yalnız bir uzantı, örnek: .txt)" -ForegroundColor Yellow
$ext = Read-Host "Uzantı"
if (-not $ext.StartsWith(".")) { $ext = ".$ext" }
# Uygulama seçimi
$ofd = New-Object System.Windows.Forms.OpenFileDialog
$ofd.Filter = "Uygulamalar (*.exe)|*.exe|Tüm Dosyalar (*.*)|*.*"
$ofd.Title = "Uygulama Seçin"
if ($ofd.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) { $appPath = $ofd.FileName }
else { Write-Host "İşlem iptal edildi."; Pause; AnaMenu }
# İkon seçimi
$ofd.Title = "İkon Seçin"
if ($ofd.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) { $iconPath = $ofd.FileName }
else { Write-Host "İşlem iptal edildi."; Pause; AnaMenu }
try {
$extKey = "HKCU:\Software\Classes\$ext"
$className = "$($ext.TrimStart('.'))File"
$classKey = "HKCU:\Software\Classes\$className"
If (-Not (Test-Path $extKey)) { New-Item -Path $extKey -Force | Out-Null }
Set-ItemProperty -Path $extKey -Name "(Default)" -Value $className
If (-Not (Test-Path $classKey)) { New-Item -Path $classKey -Force | Out-Null }
Set-ItemProperty -Path $classKey -Name "(Default)" -Value "$className Belgesi"
$iconKey = Join-Path $classKey "DefaultIcon"
If (-Not (Test-Path $iconKey)) { New-Item -Path $iconKey -Force | Out-Null }
Set-ItemProperty -Path $iconKey -Name "(Default)" -Value "$iconPath,0"
$openKey = Join-Path $classKey "shell\open\command"
If (-Not (Test-Path $openKey)) { New-Item -Path $openKey -Force | Out-Null }
Set-ItemProperty -Path $openKey -Name "(Default)" -Value "`"$appPath`" `"%1`""
Write-Host "`n$ext uzantısı başarıyla tanıtıldı!" -ForegroundColor Green
} catch { Write-Host "Hata: $_" -ForegroundColor Red }
Pause
AnaMenu
}
# ==================================================
# Seçenek 4: Seçili uzantıları yedekleme
function SecimliYedekleme {
Write-Host "`nYedeklemek istediğiniz uzantıları girin (örn: .TRWE_2012,.PDF,.pdf,TRWE_2012,pdf)" -ForegroundColor Yellow
$inputExt = Read-Host "Uzantılar"
$extArray = $inputExt.Split(",") | ForEach-Object { $_.Trim(); if (-not $_.StartsWith(".")) { "." + $_ } }
$desktop = [Environment]::GetFolderPath("Desktop")
$backupFile = Join-Path $desktop "TRWE_2012_Secimli_Yedek.reg"
$foundCount = 0
"Windows Registry Editor Version 5.00`r`n" | Out-File -FilePath $backupFile -Encoding Unicode
foreach ($ext in $extArray) {
$extKeyPath = "HKCU\Software\Classes\$ext"
$className = "$($ext.TrimStart('.'))File"
$classKeyPath = "HKCU\Software\Classes\$className"
foreach ($keyPath in @($extKeyPath, $classKeyPath)) {
try {
$tempFile = Join-Path $env:TEMP ([System.IO.Path]::GetRandomFileName() + ".reg")
reg export $keyPath $tempFile /y 2>$null
if (Test-Path $tempFile) {
$foundCount++
Get-Content $tempFile | Add-Content $backupFile
Remove-Item $tempFile -Force
}
} catch {}
}
}
if ($foundCount -gt 0) {
Write-Host "`nAraştırma tamam, $foundCount kayıt bulundu ve yedeklendi:" -ForegroundColor Green
Write-Host $backupFile -ForegroundColor Cyan
} else {
Write-Host "`nHiç kayıt bulunamadı!" -ForegroundColor Red
}
Pause
AnaMenu
}
# ==================================================
# Seçenek 5: Yedekten geri yükleme
function YedektenGeriYukleme {
Add-Type -AssemblyName System.Windows.Forms
$ofd = New-Object System.Windows.Forms.OpenFileDialog
$ofd.Filter = "Registry Dosyaları (*.reg)|*.reg|Tüm Dosyalar (*.*)|*.*"
$ofd.Title = "Yedeği seçin"
if ($ofd.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$regPath = $ofd.FileName
Write-Host "`nYedek geri yükleniyor..."
reg import $regPath
Write-Host "Yedek geri yüklendi!" -ForegroundColor Green
} else { Write-Host "İşlem iptal edildi." }
Pause
AnaMenu
}
# ==================================================
# Betik başlangıcı
AnaMenu



