免互動安裝Node.js 15、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id OpenJS.NodeJS.15 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id OpenJS.NodeJS.15 -e --silentwinget uninstall --id OpenJS.NodeJS.15 -e --silent依安裝檔
64位元 · MSI · 所有使用者
靜默安裝
msiexec /i node-v15.14.0-x64.msi /qn /norestart寫入記錄檔
msiexec /i node-v15.14.0-x64.msi /qn /norestart /l*v "%TEMP%\node-js-15-install.log"解除安裝
msiexec /x {C6D70F34-C254-4D55-B4A0-55F921939297} /qn /norestart- MSI產品代碼
- {C6D70F34-C254-4D55-B4A0-55F921939297}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C6D70F34-C254-4D55-B4A0-55F921939297}
64位元 · ZIP
免安裝(可攜版)
32位元 · MSI · 所有使用者
靜默安裝
msiexec /i node-v15.14.0-x86.msi /qn /norestart寫入記錄檔
msiexec /i node-v15.14.0-x86.msi /qn /norestart /l*v "%TEMP%\node-js-15-install.log"解除安裝
msiexec /x {28252A3F-2643-4144-AFF4-106A5C6877FA} /qn /norestart- MSI產品代碼
- {28252A3F-2643-4144-AFF4-106A5C6877FA}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{28252A3F-2643-4144-AFF4-106A5C6877FA}
32位元 · ZIP
免安裝(可攜版)
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-node-js-15.ps1
$url = 'https://nodejs.org/dist/v15.14.0/node-v15.14.0-x64.msi'
$sha256 = 'FA460C0483126BAD8296BE312F23BDC8C8BAF0974F512427B1C90846971AF29F'
$file = Join-Path $env:TEMP 'node-v15.14.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-15.ps1
$url = 'https://nodejs.org/dist/v15.14.0/node-v15.14.0-x86.msi'
$sha256 = 'D22B24E8FE60B6D730F9241C36B0F6B1A34B735EECE478DD24C0792E2576C1C8'
$file = Join-Path $env:TEMP 'node-v15.14.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