首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >静默安装.exe和.msi时,系统找不到指定的路径

静默安装.exe和.msi时,系统找不到指定的路径
EN

Stack Overflow用户
提问于 2017-06-24 02:24:16
回答 1查看 884关注 0票数 2

在将.exe下载到以下位置后,我正在尝试安装它们:

代码语言:javascript
复制
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

但是,当我尝试静默安装它时,不需要人工交互:

代码语言:javascript
复制
C:\Windows\System32\Bradford\Git-2.13.1.2-64-bit.exe /s /v"/qn"

我得到了这个错误:

代码语言:javascript
复制
The system cannot find the path specified.

另外,我也不知道如何静默安装.msi文件。在本例中,nodeJS

我正在使用一个AWS实例实例。具体地说:

代码语言:javascript
复制
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]
EN

回答 1

Stack Overflow用户

发布于 2017-08-23 06:51:21

我知道的最简单的方法就是用巧克力。

我有一些需要各种巧克力包的云服务器,我执行以下操作(类似于)来安装它们。我以前用这种方式安装过Git,这是一个完全无人值守/静默安装。

下面是一个简短的脚本,用于安装和配置Chocolatey、安装Git以及更新%PATH%。

代码语言:javascript
复制
<#
.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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44727781

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档