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