# GA-Projekte — Explorer-Protokoll einmalig installieren # Aufruf: Rechtsklick → "Mit PowerShell ausführen" $scriptPath = "$env:LOCALAPPDATA\GAApp\open-explorer.ps1" New-Item -ItemType Directory -Force -Path (Split-Path $scriptPath) | Out-Null # Helper-Skript: öffnet den Explorer mit dem übergebenen Pfad @' param([string]$url) try { # URL-Kodierung auflösen (z.B. %3A → :, %5C → \, %20 → Leerzeichen) $decoded = [System.Uri]::UnescapeDataString($url) # Protokoll-Prefix entfernen: exploreropen:/// oder exploreropen://// $path = $decoded -replace '^exploreropen:///', '' if ($path.StartsWith('/')) { # UNC-Pfad: //server/share → nach Strip: /server/share → \\server\share $path = '\\' + ($path.TrimStart('/') -replace '/', '\') } else { # Laufwerkspfad: Q:/Ordner → Q:\Ordner $path = $path -replace '/', '\' } Start-Process explorer.exe $path } catch { Add-Type -AssemblyName PresentationFramework [System.Windows.MessageBox]::Show( "Pfad konnte nicht geöffnet werden.`n`nFehler: $_`nURL: $url", "GA-Projekte", 'OK', 'Error') } '@ | Set-Content -Path $scriptPath -Encoding UTF8 # Protokoll in Windows Registry eintragen (nur aktueller Benutzer, kein Admin nötig) $reg = "HKCU:\Software\Classes\exploreropen" New-Item -Path $reg -Force | Out-Null Set-ItemProperty -Path $reg -Name "(default)" -Value "URL:GA-Projekte Explorer" Set-ItemProperty -Path $reg -Name "URL Protocol" -Value "" New-Item -Path "$reg\DefaultIcon" -Force | Out-Null Set-ItemProperty -Path "$reg\DefaultIcon" -Name "(default)" -Value "explorer.exe,0" New-Item -Path "$reg\shell\open\command" -Force | Out-Null # -WindowStyle Hidden: kein Fenster-Flash mehr $cmd = "powershell.exe -WindowStyle Hidden -NonInteractive -File `"$scriptPath`" `"%1`"" Set-ItemProperty -Path "$reg\shell\open\command" -Name "(default)" -Value $cmd Write-Host "" Write-Host "Protokoll installiert!" -ForegroundColor Green Write-Host "Skript liegt unter: $scriptPath" -ForegroundColor Gray Write-Host "Browser neu starten, dann funktioniert der Klick auf Archiv-Pfade." -ForegroundColor Cyan Write-Host "" pause