Reputation: 16469
I am trying to install my .exe
after downloading them into:
wget "https://github.com/git-for-windows/git/releases/downloadv2.13.1.windows.2/Git-2.13.1.2-64-bit.exe" -outfile c:\Windows\System32\Bradford\Git-2.13.1.2-64-bit.exe
However, when I try to install it silently, without human interaction:
C:\Windows\System32\Bradford\Git-2.13.1.2-64-bit.exe /s /v"/qn"
I am getting this error:
The system cannot find the path specified.
Also I do not know how to install a .msi
file silently as well. In this case, nodeJS
I am using a AWS instance instance. Specifically:
Microsoft Windows Server 2012 R2 with SQL Server Express - ami-37b39552
Microsoft Windows Server 2012 R2 Standard edition, 64-bit architecture, Microsoft SQL Server 2016 Express edition. [English]
Upvotes: 2
Views: 1258
Reputation: 1088
The easiest way I know how to do this is with Chocolatey.
I have some cloud servers that need various Chocolatey packages, and I do (something like) the following to install them. I have installed Git this way before, and it is a completely unattended / silent install.
Here's a short script that handles installing and configuring Chocolatey, installing Git, and updating the %PATH%.
<#
.description
Get the PATH environment variables from Machine, User, and
Process locations, and update the current Powershell
process's PATH variable to contain all values from each of
them. Call it after updating the Machine or User PATH value
(which may happen automatically during say installing
software) so you don't have to launch a new Powershell
process to get them.
#>
function Update-EnvironmentPath {
[CmdletBinding()] Param()
$oldPath = $env:PATH
$machinePath = [Environment]::GetEnvironmentVariable("PATH", "Machine") -split ";"
$userPath = [Environment]::GetEnvironmentVariable("PATH", "User") -split ";"
$processPath = [Environment]::GetEnvironmentVariable("PATH", "Process") -split ";"
$env:PATH = ($machinePath + $userPath + $processPath | Select-Object -Unique) -join ";"
Write-EventLogWrapper -message "Updated PATH environment variable`r`n`r`nNew value: $($env:PATH -replace ';', "`r`n")`r`n`r`nOld value: $($oldPath -replace ';', "`r`n")"
}
# Install Chocolatey itself:
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression
# NOTE: Chocolatey changes the system %PATH%, so we have to get the latest update here:
Update-EnvironmentPath
# Configure Chocolatey to not require confirmation when installing packages:
choco.exe feature enable --name=allowGlobalConfirmation --yes
# Install the package we care about
choco.exe install git
# Installing Git also changes the system %PATH%, so we have to update it again:
Update-EnvironmentPath
Upvotes: 1