免互動安裝Files - Preview、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id FilesCommunity.FilesPreview -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id FilesCommunity.FilesPreview -e --silentwinget uninstall --id FilesCommunity.FilesPreview -e --silent依安裝檔
64位元 · MSIX
靜默安裝
Add-AppxPackage -Path Files.Package_4.2.9.0_x64_arm64.msixbundle解除安裝
Get-AppxPackage -Name FilesPreview | Remove-AppxPackageARM64 · MSIX
靜默安裝
Add-AppxPackage -Path Files.Package_4.2.9.0_x64_arm64.msixbundle解除安裝
Get-AppxPackage -Name FilesPreview | Remove-AppxPackagePowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-files-preview.ps1
$url = 'https://cdn.files.community/files/preview/Files.Package_4.2.9.0_Test/Files.Package_4.2.9.0_x64_arm64.msixbundle'
$sha256 = '43B48C8D4D6EBEB15C8810317407FC239CA4A945424435071DF734F96BBBA6EE'
$file = Join-Path $env:TEMP 'Files.Package_4.2.9.0_x64_arm64.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file install-files-preview.ps1
$url = 'https://cdn.files.community/files/preview/Files.Package_4.2.9.0_Test/Files.Package_4.2.9.0_x64_arm64.msixbundle'
$sha256 = '43B48C8D4D6EBEB15C8810317407FC239CA4A945424435071DF734F96BBBA6EE'
$file = Join-Path $env:TEMP 'Files.Package_4.2.9.0_x64_arm64.msixbundle'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Add-AppxPackage -Path $file