安裝 SQL Server(或其他軟體)時彈出「以前的某個程式安裝已在安裝電腦上建立掛起的檔案操作。執行安裝程式之前必須重新啟動電腦」訊息,導致無法繼續。本文提供免重開機的登錄編輯修正法,適用於 Windows Server 2003/2008/2012 及 Windows 7/10/11。
Windows 安裝程式偵測到登錄機碼 PendingFileRenameOperations 存在待重命名/刪除/移動的檔案清單,強制要求重開機完成先前安裝的檔案替換動作。有時前一次安裝已完成,但登錄殘留未清除,造成誤判。
regedit 開啟登錄編輯器。HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
REG_MULTI_SZ)。PendingFileRenameOperations_Backup.reg 以防萬一。Remove-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue
Write-Host 'PendingFileRenameOperations 已清除,可繼續安裝。'
若問題持續,亦可檢查並清除下列機碼(同樣備份後刪除):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce 中的安裝殘留項目HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations2(較少見)此方法同樣適用於 Office、Visual Studio、Windows Update 等因「掛起檔案操作」而卡住的安裝案例。