|
|
|
|
|
|
| $backupFile = "$PSScriptRoot\path_backup.txt"
|
| $addPathScript = "$PSScriptRoot\Add-Path.ps1"
|
|
|
| if (-not (Test-Path $backupFile)) {
|
| Write-Error "❌ Ficheiro de backup não encontrado: $backupFile. Corre primeiro o Backup-Path.ps1."
|
| return
|
| }
|
|
|
| if (-not (Test-Path $addPathScript)) {
|
| Write-Error "❌ Script Add-Path.ps1 não encontrado em: $addPathScript"
|
| return
|
| }
|
|
|
|
|
| $savedPath = Get-Content -Path $backupFile -Raw
|
| $pathsToRestore = $savedPath -split ";" | Where-Object { $_ -and $_.Trim() -ne "" }
|
|
|
| if ($pathsToRestore.Count -gt 0) {
|
| Write-Host "🔄 A restaurar $($pathsToRestore.Count) caminhos usando Add-Path.ps1..." -ForegroundColor Cyan
|
|
|
|
|
| & $addPathScript -NewPaths $pathsToRestore
|
| } else {
|
| Write-Warning "Nenhum caminho encontrado no ficheiro de backup."
|
| }
|
|
|