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