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