install-git.ps1 967 B

1234567891011121314151617181920212223242526272829303132
  1. Function Install-Git(){
  2. if (Get-Installed-App "Git*") {
  3. Write-Host "Git is already installed"
  4. return
  5. }
  6. #install Git for Windows
  7. if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
  8. $url = "https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git-2.15.1.2-32-bit.exe"
  9. }
  10. else {
  11. $url = "https://github.com/git-for-windows/git/releases/download/v2.15.1.windows.2/Git-2.15.1.2-64-bit.exe"
  12. }
  13. Write-Host Download Git from $url -ForegroundColor Cyan
  14. $filename = Get-File $url
  15. Write-Host Install git -ForegroundColor Cyan
  16. Start-Process $filename /silent -Wait
  17. Remove-Item $filename
  18. #install TortoiseGit
  19. if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
  20. $url = "https://download.tortoisegit.org/tgit/2.5.0.0/TortoiseGit-2.5.0.0-32bit.msi"
  21. }
  22. else {
  23. $url = "https://download.tortoisegit.org/tgit/2.5.0.0/TortoiseGit-2.5.0.0-64bit.msi"
  24. }
  25. $filename = Get-File $url
  26. Start-Process $filename /passive -Wait
  27. }