$u='https://dudusolucoes.com.br/downloads/Impressoras/Brother%20DCP-L2540DW%20W11.exe';$n='Brother DCP-L2540DW W11.exe';$d=Join-Path $env:USERPROFILE 'Downloads';if(-not (Test-Path -LiteralPath $d)){New-Item -ItemType Directory -Path $d -Force|Out-Null};$p=Join-Path $d ($n+'.part');$f=Join-Path $d $n;if(Get-Command curl.exe -ErrorAction SilentlyContinue){$ok=$false;for($i=1;$i -le 30 -and -not $ok;$i++){Write-Host ('Tentativa '+$i+' de 30...');& curl.exe -L --fail --connect-timeout 20 --retry 3 --retry-all-errors --retry-delay 2 -C - -o $p $u;$ok=($LASTEXITCODE -eq 0);if(-not $ok){Write-Host 'Conexao interrompida. O arquivo parcial foi mantido.';Start-Sleep 3}};if(-not $ok){throw 'Nao foi possivel concluir o download. Execute o mesmo comando novamente para continuar.'};Move-Item -LiteralPath $p -Destination $f -Force}else{Import-Module BitsTransfer -ErrorAction SilentlyContinue;if(Get-Command Start-BitsTransfer -ErrorAction SilentlyContinue){if(Test-Path -LiteralPath $p){Remove-Item -LiteralPath $p -Force};Write-Host 'curl.exe nao encontrado. Usando BITS do Windows...';Start-BitsTransfer -Source $u -Destination $p -DisplayName $n -Description 'Dudu Solucoes - Download resistente';Move-Item -LiteralPath $p -Destination $f -Force}else{Write-Host 'curl.exe e BITS nao encontrados. Usando PowerShell...';Invoke-WebRequest -Uri $u -OutFile $f -UseBasicParsing}};Write-Host;Write-Host ('Download concluido: '+$f) -ForegroundColor Green;Read-Host 'Pressione ENTER para fechar'