我尝试将我的.exe
下载到:
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
然而,当我尝试以静默方式安装它时,没有人为干预:
C:\Windows\System32\Bradford\Git-2.13.1.2-64-bit.exe /s /v"/qn"
我收到此错误:
The system cannot find the path specified.
此外,我也不知道如何以静默方式安装.msi
文件。在这种情况下,nodeJS
我正在使用AWS实例实例。具体做法是:
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]
答案 0 :(得分:1)
我知道如何做到这一点的最简单方法是使用Chocolatey。
我有一些需要各种Chocolatey软件包的云服务器,而我(如下所示)安装它们。我以前用这种方式安装了Git,这是一个完全无人值守/静默的安装。
这是一个简短的脚本,用于处理安装和配置Chocolatey,安装Git以及更新%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