Last active
September 16, 2024 13:33
-
-
Save bizouarn/b99ed62eb488410832616821192281bc to your computer and use it in GitHub Desktop.
Ajouter wget à git-bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$gitPath = (Get-Command git).Path | |
if (-not $gitPath) { | |
Write-Error "Git n'est pas installé ou n'est pas dans le PATH." | |
exit 1 | |
} | |
$gitRoot = Split-Path -Path (Split-Path -Parent $gitPath) -Parent | |
$gitBinPath = Join-Path -Path $gitRoot -ChildPath "mingw64\bin" | |
$wgetUrl = "https://eternallybored.org/misc/wget/1.21.4/64/wget.exe" | |
$tempWgetPath = Join-Path -Path $env:TEMP -ChildPath "wget.exe" | |
Write-Host "Téléchargement de wget.exe..." | |
Invoke-WebRequest -Uri $wgetUrl -OutFile $tempWgetPath | |
if (Test-Path $tempWgetPath) { | |
Write-Host "wget.exe téléchargé avec succès." | |
} else { | |
Write-Error "Le fichier wget.exe n'a pas pu être téléchargé." | |
exit 1 | |
} | |
$finalWgetPath = Join-Path -Path $gitBinPath -ChildPath "wget.exe" | |
Write-Host "Copie de wget.exe vers $gitBinPath..." | |
Copy-Item -Path $tempWgetPath -Destination $finalWgetPath -Force | |
if (Test-Path $finalWgetPath) { | |
Write-Host "wget.exe a été installé avec succès dans $gitBinPath." | |
} else { | |
Write-Error "L'installation de wget.exe a échoué." | |
} | |
Remove-Item $tempWgetPath -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment