免互動安裝Node.js 7、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id OpenJS.NodeJS.7 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id OpenJS.NodeJS.7 -e --silentwinget uninstall --id OpenJS.NodeJS.7 -e --silent依安裝檔
64位元 · MSI · 所有使用者
靜默安裝
msiexec /i node-v7.1.0-x64.msi /qn /norestart寫入記錄檔
msiexec /i node-v7.1.0-x64.msi /qn /norestart /l*v "%TEMP%\node-js-7-install.log"解除安裝
msiexec /x {11A851D1-280C-4EC7-ACB8-1F4F0F4555AB} /qn /norestart- MSI產品代碼
- {11A851D1-280C-4EC7-ACB8-1F4F0F4555AB}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{11A851D1-280C-4EC7-ACB8-1F4F0F4555AB}
64位元 · ZIP
免安裝(可攜版)
32位元 · MSI · 所有使用者
靜默安裝
msiexec /i node-v7.1.0-x86.msi /qn /norestart寫入記錄檔
msiexec /i node-v7.1.0-x86.msi /qn /norestart /l*v "%TEMP%\node-js-7-install.log"解除安裝
msiexec /x {B61939BE-9A49-4C85-AC48-08519B91C0C0} /qn /norestart- MSI產品代碼
- {B61939BE-9A49-4C85-AC48-08519B91C0C0}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{B61939BE-9A49-4C85-AC48-08519B91C0C0}
32位元 · ZIP
免安裝(可攜版)
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-node-js-7.ps1
$url = 'https://nodejs.org/dist/v7.1.0/node-v7.1.0-x64.msi'
$sha256 = '853936FE0AA946E16BBAB10D1C7E964BBF7A1820D12ADBFD748D7CF9F8059FA3'
$file = Join-Path $env:TEMP 'node-v7.1.0-x64.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait install-node-js-7.ps1
$url = 'https://nodejs.org/dist/v7.1.0/node-v7.1.0-x86.msi'
$sha256 = '5D95A909788239B4ED97C5F79B2D16837EA577A1A68E34E014D0A45DE7F27B1D'
$file = Join-Path $env:TEMP 'node-v7.1.0-x86.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait